Closed
Conversation
gagdiez
reviewed
Aug 22, 2025
| private readonly contract: ChainSignatureContract | ||
| private readonly networkId: 'mainnet' | 'testnet' | ||
|
|
||
| constructor(args: { rpcUrl: string; networkId: 'mainnet' | 'testnet'; contract: ChainSignatureContract }) { |
Collaborator
There was a problem hiding this comment.
In all the other chains we take the provider directly, I would suggest to do the same (as providers might need API Keys)
gagdiez
reviewed
Aug 22, 2025
| const res = (await this.provider.query<any>(`account/${address}`, '')) as any | ||
| return { balance: BigInt(res.amount), decimals: 24 } | ||
| } catch (e) { | ||
| if (this.isAccountDoesNotExistError(e)) { |
Collaborator
There was a problem hiding this comment.
I feel that this library in particular should not handle the isAccountDoesNotExistError, since by nature chainsig.js only handles getting signatures
Otherwise, the chains acts in one way for NEAR, and in a totally different for the other chains
Here we could either return 0 on error (which would make sense) or raise the error further app
gagdiez
reviewed
Aug 22, 2025
| async deriveAddressAndPublicKey(predecessor: string, path: string): Promise<{ address: string; publicKey: string }> { | ||
| const derivedKey = await this.contract.getDerivedPublicKey({ path, predecessor, IsEd25519: true }) | ||
| const pk = NearPublicKey.fromString(derivedKey as string) | ||
| const derivedAccountId = `${path}.${predecessor}` |
Collaborator
There was a problem hiding this comment.
this look weird to me, since I would have expected the derived account to be:
- either an
implicit account - either
${predecessor}(always returnpredecessorindifferent to thepath)
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
feat(near): add NEAR adapter; consolidate to @near-js v2; update examples
Examples needed to be changed: