Skip to content
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

Add read methods #6

Merged
merged 12 commits into from
Mar 17, 2021
Merged

Add read methods #6

merged 12 commits into from
Mar 17, 2021

Conversation

germartinez
Copy link
Member

Add read methods to access the data from the Safe contract

@germartinez germartinez requested a review from mmv08 March 15, 2021 16:55
@germartinez germartinez linked an issue Mar 15, 2021 that may be closed by this pull request
* @param ethers - Ethers v5 library
* @param signer - Ethers signer
* @param safeAddress - The address of the Safe account to use
* @returns The Safe Core SDK instance
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

shouldn't return also include a type? https://jsdoc.app/tags-returns.html

btw I think typescript supports jsdoc and can generate types from it, so maybe we don't need to duplicate them: https://www.typescriptlang.org/docs/handbook/jsdoc-supported-types.html#param-and-returns

README.md Outdated
const wallet2 = ethers.Wallet.createRandom().connect(provider)

const safe = await safeContract.setup(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where is the safeContract coming from?

Copy link
Member Author

@germartinez germartinez Mar 16, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How would you represent an existing Safe account here? It doesn't make sense to me to add all the logic to explain where this is coming from.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is also weird that a direct interaction with the contract is needed before using the SDK. I guess at some point the SDK should allow to create Safes, right? Should this be prioritized?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe just add a comment like

// Existing Safe address (e.g. create from a Safe created via https://app.gnosis-safe.io
const safeAddress = "0x<some_safe_address>"

* @param hash - The data to sign
* @returns The Safe signature
*/
async signMessage(hash: string): Promise<SafeSignature> {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not sure about the name as the Safe also has a method called signMessage

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is signTransactionHash better?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, this would make it a lot clearer for me :)

@@ -49,6 +49,12 @@ export class SafeTransaction {
}
}

/**
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the baseOfsset in line 40 should probably be signers.length * 65 as we need the offset in bytes not in chars.

Base automatically changed from handle-signatures to main March 17, 2021 10:59
@germartinez germartinez merged commit fc490b1 into main Mar 17, 2021
@germartinez germartinez deleted the read-methods branch March 17, 2021 11:49
@github-actions github-actions bot locked and limited conversation to collaborators Mar 17, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add read functions
3 participants