-
Notifications
You must be signed in to change notification settings - Fork 105
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
Supporting the new SDK with wallet adapter #193
Conversation
140878a
to
3ca6848
Compare
1e3131f
to
21533d9
Compare
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.
Did we have anything else to get into the wallet adapter @0xmaayan for a release, otherwise, I suggest we get this in and just start iterating quickly on fixing what we want in the interface.
The sponsored transaction stuff as well as other pieces are quickly showing that they need a unified interface, and a split interface on the backend (as you mentioned in the other PR), and if we are going to deprecate the multiple functions, we'll need to drive towards that.
Thoughts?
@@ -49,7 +50,7 @@ export interface WalletContextState { | |||
): Promise<any>; | |||
signMessage(message: SignMessagePayload): Promise<SignMessageResponse | null>; | |||
signMessageAndVerify(message: SignMessagePayload): Promise<boolean>; | |||
|
|||
submitTransaction(transaction: InputGenerateTransactionData): Promise<any>; |
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.
Okay... we need to make this better.
any
doesn't cut it anymore. We should at least make it return a hash string or an object with a hash string so it can be extended accordingly.
I think we need to move towards v2, it consolidates lots of the weird things we are doing here trying to support existing adapter, sdk v1 and sdk v2. |
Let's get this in @xbtmatt, and let's get it rolling on wallet adapter V2 with more functionality. |
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.
Please make an interface for the output of submitTransaction
of {hash: string}
b900d51
to
68ff598
Compare
Consolidating things and removing comments Updating package.json and removing unnecessary imports
Make submitTransaction return { hash: string, output?: any }
66cfa7c
to
fd5160c
Compare
@xbtmatt please run |
681a7f2
to
e79f126
Compare
Description
This is the initial attempt at supporting the new SDK with the wallet adapter.
Namely, there is now a
submitTransaction
(TBD: new name) function where you can submit BCS inputs and it converts it to a BCS payload that's compatible with the v1 SDK. It then relays this call to thesignAndSubmitBCSTransaction
function that already exists.This facilitates signing and submitting a transaction using the v2 SDK without having to wait on wallets to implement any code for it.
The wallet adapter is still extremely limited in what it can do- this is an initial attempt at getting a single transaction to submit.
Building
To use a local ts-sdk version with exported types (such as from the PR mentioned below), you must update the version in @aptos-labs/ts-sdk to link your local dependency, specifically in the
apps/nextjs-example/package.json
and
packages/wallet-adapter-core/package.json
Testing
go to the nextjs-example app,
yarn run dev
, and try to submit a transaction in the optional section at the bottom of the dapp. It will be for the v2 SDKIt should succeed. This relies on: #139 from the wallet adapter.