-
Notifications
You must be signed in to change notification settings - Fork 747
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[VIP] V6 saitama #908
Open
tabaktoni
wants to merge
16
commits into
develop
Choose a base branch
from
v6/beta/final
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
[VIP] V6 saitama #908
Changes from all commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
c420872
fix: wip temp commit, extracting types to provider and rest
tabaktoni 24941b3
chore: leftover
tabaktoni 7a54fa2
chore: ignore scripts
tabaktoni 7da499d
Merge branch 'beta' into v6/beta/final
tabaktoni 2347018
chore: vip
tabaktoni f5ef12b
Merge branch 'develop' into v6/beta/final
tabaktoni 5c28282
feat: custom rpcprovider without channel, speckVersion setup, tests fix
tabaktoni 68cb801
chore: channel constructor props
tabaktoni 3991977
feat: use existing rpc provider instance for Account
tabaktoni 4806201
feat: new AccountInstance for creating Account from provider instance
tabaktoni aa56f1f
chore: forgoten files
tabaktoni f065ff3
Merge branch 'develop' into v6/beta/final
tabaktoni 83011be
Update __tests__/accountInstance.test.ts
tabaktoni 2e6e087
chore: cleanup
tabaktoni 357d3dc
Merge branch 'develop' into v6/beta/final
tabaktoni f056536
chore: post merge
tabaktoni File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,4 +10,5 @@ dist | |
node_modules | ||
npm-debug.log | ||
package | ||
yarn.lock | ||
yarn.lock | ||
__tests__/scripts |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import { Account, AccountInstance, LibraryError, RpcProvider } from '../src'; | ||
|
||
describe('Account instantiated from provider instance', () => { | ||
const rpc = new RpcProvider(); | ||
const getNonceMock = jest.fn().mockResolvedValue('mock'); | ||
rpc.getNonceForAddress = getNonceMock; | ||
|
||
test('Account to throw on extended custom methods for using re-instantiation on provider', () => { | ||
const acc = new Account(rpc, '0x0', '0x1'); | ||
|
||
return expect(acc.getNonceForAddress('0x0')).rejects.toThrow(LibraryError); | ||
}); | ||
|
||
test('AccountInstance to pass on extending', async () => { | ||
const acc = new AccountInstance(rpc, '0x0', '0x1'); | ||
expect(await acc.getNonceForAddress('0x1')).toBe('mock'); | ||
expect(getNonceMock).toHaveBeenLastCalledWith('0x1'); | ||
}); | ||
|
||
test('Account to pass on extended custom methods for using instance on provider', async () => { | ||
const acc = new Account(rpc, '0x0', '0x1', undefined, undefined, true); | ||
expect(await acc.getNonceForAddress('0x2')).toBe('mock'); | ||
expect(getNonceMock).toHaveBeenLastCalledWith('0x2'); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import { DEFAULT_TRANSACTION_VERSION } from '../constants'; | ||
import { ProviderInterface } from '../provider/interface'; | ||
import { SignerInterface } from '../signer/interface'; | ||
import { CairoVersion, ETransactionVersion, ProviderOptions } from '../types'; | ||
import { Account } from '.'; | ||
|
||
export class AccountInstance extends Account { | ||
constructor( | ||
providerOrOptions: ProviderOptions | ProviderInterface, | ||
address: string, | ||
pkOrSigner: Uint8Array | string | SignerInterface, | ||
cairoVersion?: CairoVersion, | ||
transactionVersion: | ||
| ETransactionVersion.V2 | ||
| ETransactionVersion.V3 = DEFAULT_TRANSACTION_VERSION | ||
) { | ||
super(providerOrOptions, address, pkOrSigner, cairoVersion, transactionVersion, true); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This
instance
parameter and the newAccountInstance
class feels like it could be confusing to users. I suggest evaluating if a different term might be a better fit, maybe something likeinheritable
orinheritableProvider
.Adding @ivpavici since he's had success with naming things.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The idea is that the user create Acc from the instance and not class.
Is there a better name to fit I'm fine with it, I am not supper happy with this name also, but it was only one logical to me.