|
| 1 | +interface Error { |
| 2 | + message: string; // general description message returned to the client app |
| 3 | + code: number; // unique error code |
| 4 | + ext?: Array<string>; // optional extended details |
| 5 | +} |
| 6 | + |
| 7 | +export interface Sep43Interface { |
| 8 | + /** |
| 9 | + * Function used to request the public key from the active account |
| 10 | + * |
| 11 | + * @return Promise<{ address: string } & { error?: Error }> |
| 12 | + */ |
| 13 | + getAddress(): Promise<{ address: string } & { error?: Error }>; |
| 14 | + |
| 15 | + /** |
| 16 | + * A function to request a wallet to sign a built transaction in its XDR mode |
| 17 | + * |
| 18 | + * @param xdr - A Transaction or a FeeBumpTransaction |
| 19 | + * @param opts - Options compatible with https://github.com/stellar/stellar-protocol/blob/master/ecosystem/sep-0043.md#signtransaction |
| 20 | + * @param opts.networkPassphrase - The Stellar network to use when signing |
| 21 | + * @param opts.address - The public key of the account that should be used to sign |
| 22 | + * @param opts.path - This options is added for special cases like Hardware wallets |
| 23 | + * |
| 24 | + * @return Promise<{ signedTxXdr: string; signerAddress: string } & { error?: Error }> |
| 25 | + */ |
| 26 | + signTransaction( |
| 27 | + xdr: string, |
| 28 | + opts?: { |
| 29 | + networkPassphrase?: string; |
| 30 | + address?: string; |
| 31 | + path?: string; |
| 32 | + submit?: boolean; |
| 33 | + submitUrl?: string; |
| 34 | + }, |
| 35 | + ): Promise< |
| 36 | + { signedTxXdr: string; signerAddress: string } & { error?: Error } |
| 37 | + >; |
| 38 | + |
| 39 | + /** |
| 40 | + * A function to request a wallet to sign an AuthEntry XDR. |
| 41 | + * |
| 42 | + * @param authEntry - An XDR string version of `HashIdPreimageSorobanAuthorization` |
| 43 | + * @param opts - Options compatible with https://github.com/stellar/stellar-protocol/blob/master/ecosystem/sep-0043.md#signauthentry |
| 44 | + * @param opts.networkPassphrase - The Stellar network to use when signing |
| 45 | + * @param opts.address - The public key of the account that should be used to sign |
| 46 | + * @param opts.path - This options is added for special cases like Hardware wallets |
| 47 | + * |
| 48 | + * @return - Promise<{ signedAuthEntry: string; signerAddress: string } & { error?: Error }> |
| 49 | + */ |
| 50 | + signAuthEntry( |
| 51 | + authEntry: string, |
| 52 | + opts?: { |
| 53 | + networkPassphrase?: string; |
| 54 | + address?: string; |
| 55 | + path?: string; |
| 56 | + }, |
| 57 | + ): Promise< |
| 58 | + { signedAuthEntry: string; signerAddress: string } & { error?: Error } |
| 59 | + >; |
| 60 | + |
| 61 | + /** |
| 62 | + * A function to request a wallet to sign an AuthEntry XDR. |
| 63 | + * |
| 64 | + * @param message - An arbitrary string rather than a transaction or auth entry |
| 65 | + * @param opts - Options compatible with https://github.com/stellar/stellar-protocol/blob/master/ecosystem/sep-0043.md#signmessage |
| 66 | + * @param opts.networkPassphrase - The Stellar network to use when signing |
| 67 | + * @param opts.address - The public key of the account that should be used to sign |
| 68 | + * @param opts.path - This options is added for special cases like Hardware wallets |
| 69 | + * |
| 70 | + * @return - Promise<{ signedMessage: string; signerAddress: string } & { error?: Error }> |
| 71 | + */ |
| 72 | + signMessage( |
| 73 | + message: string, |
| 74 | + opts?: { |
| 75 | + networkPassphrase?: string; |
| 76 | + address?: string; |
| 77 | + path?: string; |
| 78 | + }, |
| 79 | + ): Promise< |
| 80 | + { signedMessage: string; signerAddress: string } & { error?: Error } |
| 81 | + >; |
| 82 | + |
| 83 | + /** |
| 84 | + * A function to request the current selected network in the wallet. This comes |
| 85 | + * handy when you are dealing with a wallet that doesn't allow you to specify which network to use (For example Lobstr and Rabet) |
| 86 | + * |
| 87 | + * @return - Promise<{ network: string; networkPassphrase: string } & { error?: Error }> |
| 88 | + */ |
| 89 | + getNetwork(): Promise< |
| 90 | + { network: string; networkPassphrase: string } & { error?: Error } |
| 91 | + >; |
| 92 | +} |
0 commit comments