-
Notifications
You must be signed in to change notification settings - Fork 121
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat/1012: Improve Tx API in SDK (#1033)
* feat: add Tx schema and type for inspecting transactions from SDK * feat: continue hooking up new Tx type * fix: serialize and deserialize properly * feat: support all existing Tx * feat: improve signing & broadcast API * docs: regenerate docs for types & sdk
- Loading branch information
Showing
75 changed files
with
1,003 additions
and
1,185 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
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 |
---|---|---|
@@ -1,17 +1,24 @@ | ||
import { TxData } from "@namada/types"; | ||
import { SigningDataProps, TxProps } from "@namada/types"; | ||
|
||
export type ApprovedOriginsStore = string[]; | ||
|
||
export type PendingTx = { | ||
txs: TxData[]; | ||
txs: TxProps[]; | ||
signer: string; | ||
checksums?: Record<string, string>; | ||
}; | ||
|
||
export type PendingSignArbitrary = string; | ||
|
||
// base64 encoded Tx data for use with postMessage | ||
export type EncodedTxData = { | ||
txBytes: string; | ||
signingDataBytes: string[]; | ||
// base64 encoded Uint8Arrays for use with postMessage | ||
export type EncodedSigningData = Pick< | ||
SigningDataProps, | ||
"publicKeys" | "threshold" | "feePayer" | "owner" | ||
> & { | ||
accountPublicKeysMap?: string; | ||
}; | ||
|
||
export type EncodedTxData = Pick<TxProps, "args" | "hash"> & { | ||
bytes: string; | ||
signingData: EncodedSigningData[]; | ||
}; |
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
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 |
---|---|---|
@@ -1,9 +1,9 @@ | ||
import { BuiltTx } from "@heliax/namada-sdk/web"; | ||
import { TxProps } from "@namada/types"; | ||
|
||
export const createNotificationId = (data?: BuiltTx | BuiltTx[]): string => { | ||
export const createNotificationId = (data?: TxProps | TxProps[]): string => { | ||
if (!data) return Date.now().toString(); | ||
if (Array.isArray(data)) { | ||
return data.map((tx) => tx.tx_hash()).join(";"); | ||
return data.map((tx) => tx.hash).join(";"); | ||
} | ||
return data.tx_hash(); | ||
return data.hash; | ||
}; |
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.