-
Notifications
You must be signed in to change notification settings - Fork 105
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Supporting the new SDK with wallet adapter (#193)
* Initial commit of working on v2 wallet adapter Consolidating things and removing comments Updating package.json and removing unnecessary imports * Move signAndSubmitBCSTransaction back up * Adding updated types to make wallet adapter work * Remove old TypeTagParser * Update documentation to clarify v2 sdk * Remove signAnyTransaction for now * Updating documentation/comments * Remove unused functions * Add account undefined check * Updating @aptos-labs/ts-sdk version and changing new TypeTagParser to parseTypeTag() * Make submitTransaction return { hash: string, output?: any } Make submitTransaction return { hash: string, output?: any } * Using BCS arguments instead of simple ones * Rebasing and updating pnpm-lock.yaml * Removing extraneous package * Adding changeset
- Loading branch information
Showing
11 changed files
with
3,448 additions
and
2,985 deletions.
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 |
---|---|---|
@@ -0,0 +1,7 @@ | ||
--- | ||
"@aptos-labs/wallet-adapter-react": minor | ||
"@aptos-labs/wallet-adapter-core": minor | ||
"@aptos-labs/wallet-adapter-nextjs-example": minor | ||
--- | ||
|
||
Adding support for the new Typescript SDK in the package `@aptos-labs/ts-sdk`. The wallet adapter now supports submitting a basic transaction with the new SDK types. |
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
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,24 @@ | ||
import { Network, AnyTransactionPayloadInstance } from "@aptos-labs/ts-sdk" | ||
import { BCS, TxnBuilderTypes } from "aptos" | ||
import { NetworkInfo } from "./types"; | ||
import { NetworkName } from "./constants"; | ||
|
||
// old => new | ||
export function convertNetwork(networkInfo: NetworkInfo | null): Network { | ||
switch(networkInfo?.name.toLowerCase()) { | ||
case "mainnet" as NetworkName: | ||
return Network.MAINNET; | ||
case "testnet" as NetworkName: | ||
return Network.TESTNET; | ||
case "devnet" as NetworkName: | ||
return Network.DEVNET; | ||
default: | ||
throw new Error("Invalid network name") | ||
} | ||
} | ||
|
||
// new => old | ||
export function convertToBCSPayload(payload: AnyTransactionPayloadInstance): TxnBuilderTypes.TransactionPayload { | ||
const deserializer = new BCS.Deserializer(payload.bcsToBytes()); | ||
return TxnBuilderTypes.TransactionPayload.deserialize(deserializer); | ||
} |
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.