@human.tech/waap-sdk 1.2.4 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +25 -1
- package/dist/index.d.mts +967 -0
- package/dist/index.d.ts +967 -15
- package/dist/index.js +2191 -2
- package/dist/index.mjs +2162 -0
- package/package.json +18 -36
- package/dist/hooks/useWaapTransaction.d.ts +0 -84
- package/dist/index.js.map +0 -1
- package/dist/index.modern.mjs +0 -2
- package/dist/index.modern.mjs.map +0 -1
- package/dist/index.module.js +0 -2
- package/dist/index.module.js.map +0 -1
- package/dist/index.umd.js +0 -2
- package/dist/index.umd.js.map +0 -1
- package/dist/lib/UIMessageManager.d.ts +0 -19
- package/dist/lib/WalletConnect.d.ts +0 -30
- package/dist/lib/WalletMessageManager.d.ts +0 -59
- package/dist/lib/provider/EthereumProvider.d.ts +0 -108
- package/dist/lib/provider/EthereumProviderExtension.d.ts +0 -26
- package/dist/lib/provider/requests.d.ts +0 -17
- package/dist/lib/provider/types.d.ts +0 -49
- package/dist/lib/provider/utils.d.ts +0 -4
- package/dist/lib/sui/SuiWallet.d.ts +0 -182
- package/dist/lib/sui/index.d.ts +0 -7
- package/dist/lib/sui/init.d.ts +0 -30
- package/dist/lib/sui/register.d.ts +0 -39
- package/dist/lib/sui/types.d.ts +0 -284
- package/dist/ui/WaapComponent.d.ts +0 -37
- package/dist/ui/index.d.ts +0 -11
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* A Ethereum provder API (from EIP 1193) for Silk.
|
|
3
|
-
* https://eips.ethereum.org/EIPS/eip-1193
|
|
4
|
-
*/
|
|
5
|
-
/**
|
|
6
|
-
* Resources:
|
|
7
|
-
* - EIP-2255: Wallet Permissions System: https://eips.ethereum.org/EIPS/eip-2255
|
|
8
|
-
*/
|
|
9
|
-
import { CredentialType, CustomConfig } from '@human.tech/waap-interface-core';
|
|
10
|
-
import { EventEmitter } from 'events';
|
|
11
|
-
import { EthereumProviderInterface, RequestArguments } from './types.js';
|
|
12
|
-
declare class EthereumProviderExtension extends EventEmitter implements EthereumProviderInterface {
|
|
13
|
-
readonly isSilk = true;
|
|
14
|
-
connected: boolean;
|
|
15
|
-
config: CustomConfig;
|
|
16
|
-
constructor(customConfig?: CustomConfig);
|
|
17
|
-
sendToExtension(args: RequestArguments): Promise<unknown>;
|
|
18
|
-
request(args: RequestArguments): Promise<unknown>;
|
|
19
|
-
enable(): Promise<unknown>;
|
|
20
|
-
isConnected(): boolean;
|
|
21
|
-
login(): Promise<unknown>;
|
|
22
|
-
requestSBT(type: CredentialType): Promise<unknown>;
|
|
23
|
-
toggleDarkMode(): Promise<void>;
|
|
24
|
-
safe(): Promise<unknown>;
|
|
25
|
-
}
|
|
26
|
-
export { EthereumProviderExtension };
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { EventEmitter } from 'events';
|
|
2
|
-
import { rpcMethodRequiresUI } from '@human.tech/waap-constants';
|
|
3
|
-
import WalletMessageManager from '../WalletMessageManager.js';
|
|
4
|
-
import { RequestArguments } from './types.js';
|
|
5
|
-
/**
|
|
6
|
-
* Options passed to iframe for transaction behavior
|
|
7
|
-
*/
|
|
8
|
-
interface SilkOptions {
|
|
9
|
-
async?: boolean;
|
|
10
|
-
withPT?: boolean;
|
|
11
|
-
}
|
|
12
|
-
/**
|
|
13
|
-
* Send request to wallet in iframe, and upon receiving the wallet's response
|
|
14
|
-
* or error, hide modal and return wallet's response or throw wallet's error.
|
|
15
|
-
*/
|
|
16
|
-
declare function handleWalletRequestAndResponse(args: RequestArguments, interactionRequired: boolean, walletMessageManager: WalletMessageManager, internalProviderEventEmitter: EventEmitter, silkOptions?: SilkOptions): Promise<unknown>;
|
|
17
|
-
export { rpcMethodRequiresUI, handleWalletRequestAndResponse };
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
import { CustomConfig, ProjectConfig, CredentialType, RequestPermissionTokenParams } from '@human.tech/waap-interface-core';
|
|
2
|
-
export type ArrayOneOrMore<T> = {
|
|
3
|
-
0: T;
|
|
4
|
-
} & Array<T>;
|
|
5
|
-
export interface RequestArguments {
|
|
6
|
-
method: string;
|
|
7
|
-
params?: unknown[] | object;
|
|
8
|
-
async?: boolean;
|
|
9
|
-
withPT?: boolean;
|
|
10
|
-
}
|
|
11
|
-
export interface EthereumProviderInterface {
|
|
12
|
-
enable(): Promise<unknown>;
|
|
13
|
-
isConnected(): boolean;
|
|
14
|
-
request(args: RequestArguments): Promise<unknown>;
|
|
15
|
-
on(event: string, listener: (...args: any[]) => void): this;
|
|
16
|
-
removeListener(event: string, listener: (...args: any[]) => void): this;
|
|
17
|
-
}
|
|
18
|
-
export type LoginResponse = 'waap' | 'human' | 'injected' | 'walletconnect' | null;
|
|
19
|
-
export interface SilkEthereumProviderInterface extends EthereumProviderInterface {
|
|
20
|
-
isSilk: boolean;
|
|
21
|
-
connected: boolean;
|
|
22
|
-
login(customProvider?: any): Promise<LoginResponse>;
|
|
23
|
-
logout(): Promise<unknown>;
|
|
24
|
-
getLoginMethod(): LoginResponse;
|
|
25
|
-
requestEmail(): Promise<unknown>;
|
|
26
|
-
requestSBT(type: CredentialType): Promise<unknown>;
|
|
27
|
-
requestPermissionToken(params: RequestPermissionTokenParams): Promise<unknown>;
|
|
28
|
-
toggleDarkMode(): Promise<void>;
|
|
29
|
-
}
|
|
30
|
-
export interface InitSilkOptions {
|
|
31
|
-
referralCode?: string;
|
|
32
|
-
project?: ProjectConfig;
|
|
33
|
-
config?: CustomConfig;
|
|
34
|
-
useStaging?: boolean;
|
|
35
|
-
walletConnectProjectId?: string;
|
|
36
|
-
/**
|
|
37
|
-
* When true, eth_sendTransaction resolves with the pre-calculated tx hash
|
|
38
|
-
* immediately after signing. Broadcasting and confirmation continue in the
|
|
39
|
-
* background with events (waap_sign_complete, waap_tx_pending, waap_tx_confirmed, waap_tx_failed).
|
|
40
|
-
* Other signing methods (personal_sign, eth_signTypedData_v4, eth_signTransaction)
|
|
41
|
-
* are unaffected — they always resolve with the signature directly.
|
|
42
|
-
* Applies to ALL eth_sendTransaction calls for this SDK instance.
|
|
43
|
-
* Default: false
|
|
44
|
-
*/
|
|
45
|
-
asyncTxs?: boolean;
|
|
46
|
-
/** @deprecated Use `asyncTxs` instead. */
|
|
47
|
-
asyncSigning?: boolean;
|
|
48
|
-
}
|
|
49
|
-
export type SilkProvider = SilkEthereumProviderInterface;
|
|
@@ -1,182 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* WaaP Sui Wallet - Implements Sui Wallet Standard.
|
|
3
|
-
*
|
|
4
|
-
* This wallet adapter allows dApps using @mysten/dapp-kit to discover
|
|
5
|
-
* and interact with WaaP wallet for Sui blockchain operations.
|
|
6
|
-
*
|
|
7
|
-
* @see https://docs.sui.io/standards/wallet-standard
|
|
8
|
-
*/
|
|
9
|
-
import { UIMessageManager } from '../UIMessageManager.js';
|
|
10
|
-
import type { SuiAccount, SuiChain, SuiConnectInput, SuiConnectOutput, SuiSignPersonalMessageInput, SuiSignPersonalMessageOutput, SuiSignAndExecuteTransactionInput, SuiSignAndExecuteTransactionOutput, SuiSignTransactionBlockInput, SuiSignTransactionBlockOutput, SuiSignAndExecuteTransactionBlockInput, SuiSignAndExecuteTransactionBlockOutput, SuiWalletEventListener, WaaPSuiWalletInterface, WalletIcon, InitWaaPSuiOptions } from './types.js';
|
|
11
|
-
/**
|
|
12
|
-
* WaaP Sui Wallet implementation.
|
|
13
|
-
*
|
|
14
|
-
* Implements the Sui Wallet Standard to allow dApps to:
|
|
15
|
-
* - Connect/disconnect
|
|
16
|
-
* - Sign personal messages
|
|
17
|
-
* - (Future) Sign and execute transactions
|
|
18
|
-
*/
|
|
19
|
-
export declare class WaaPSuiWallet implements WaaPSuiWalletInterface {
|
|
20
|
-
readonly name = "WaaP";
|
|
21
|
-
readonly version = "1.0.0";
|
|
22
|
-
readonly icon: WalletIcon;
|
|
23
|
-
private _accounts;
|
|
24
|
-
private _chains;
|
|
25
|
-
private walletMessageManager;
|
|
26
|
-
private uiMessageManager;
|
|
27
|
-
private internalEventEmitter;
|
|
28
|
-
private changeListeners;
|
|
29
|
-
/**
|
|
30
|
-
* Creates a new WaaPSuiWallet instance.
|
|
31
|
-
*
|
|
32
|
-
* @param iframeWindow - The contentWindow of the WaaP iframe
|
|
33
|
-
* @param options - Initialization options
|
|
34
|
-
*/
|
|
35
|
-
constructor(iframeWindow: Window, options?: InitWaaPSuiOptions);
|
|
36
|
-
/**
|
|
37
|
-
* Refresh accounts by making a silent connect request.
|
|
38
|
-
* Used internally when account changes are detected.
|
|
39
|
-
*/
|
|
40
|
-
private refreshAccounts;
|
|
41
|
-
/**
|
|
42
|
-
* Supported chains.
|
|
43
|
-
*/
|
|
44
|
-
get chains(): readonly SuiChain[];
|
|
45
|
-
/**
|
|
46
|
-
* Connected accounts.
|
|
47
|
-
*/
|
|
48
|
-
get accounts(): readonly SuiAccount[];
|
|
49
|
-
/**
|
|
50
|
-
* UI message manager for showing/hiding modal.
|
|
51
|
-
*/
|
|
52
|
-
get ui(): UIMessageManager;
|
|
53
|
-
/**
|
|
54
|
-
* Connect to the wallet.
|
|
55
|
-
*/
|
|
56
|
-
connect(input?: SuiConnectInput): Promise<SuiConnectOutput>;
|
|
57
|
-
/**
|
|
58
|
-
* Disconnect from the wallet.
|
|
59
|
-
*/
|
|
60
|
-
disconnect(): Promise<void>;
|
|
61
|
-
/**
|
|
62
|
-
* Sign a personal message.
|
|
63
|
-
*
|
|
64
|
-
* @param input - Sign personal message input
|
|
65
|
-
* @returns Signed message result with bytes and signature
|
|
66
|
-
*/
|
|
67
|
-
signPersonalMessage(input: SuiSignPersonalMessageInput): Promise<SuiSignPersonalMessageOutput>;
|
|
68
|
-
/**
|
|
69
|
-
* Helper to resolve transaction bytes from various input formats.
|
|
70
|
-
* If the input is a Transaction/TransactionBlock object, it builds it.
|
|
71
|
-
*/
|
|
72
|
-
private resolveTransactionBytes;
|
|
73
|
-
/**
|
|
74
|
-
* Sign a transaction.
|
|
75
|
-
*
|
|
76
|
-
* @param input - Sign transaction input with transaction
|
|
77
|
-
* @returns Signed transaction result with bytes and signature
|
|
78
|
-
*/
|
|
79
|
-
signTransaction(input: {
|
|
80
|
-
transaction: unknown;
|
|
81
|
-
account: SuiAccount;
|
|
82
|
-
chain?: SuiChain;
|
|
83
|
-
}): Promise<{
|
|
84
|
-
bytes: string;
|
|
85
|
-
signature: string;
|
|
86
|
-
}>;
|
|
87
|
-
/**
|
|
88
|
-
* Sign and execute a transaction.
|
|
89
|
-
*
|
|
90
|
-
* @param input - Sign and execute transaction input
|
|
91
|
-
*/
|
|
92
|
-
signAndExecuteTransaction(input: SuiSignAndExecuteTransactionInput): Promise<SuiSignAndExecuteTransactionOutput>;
|
|
93
|
-
/**
|
|
94
|
-
* Switch the active chain.
|
|
95
|
-
*/
|
|
96
|
-
switchChain(input: {
|
|
97
|
-
chain: SuiChain;
|
|
98
|
-
}): Promise<void>;
|
|
99
|
-
/**
|
|
100
|
-
* Subscribe to wallet change events.
|
|
101
|
-
*
|
|
102
|
-
* @param event - Event name (currently only 'change')
|
|
103
|
-
* @param listener - Event listener callback
|
|
104
|
-
* @returns Unsubscribe function
|
|
105
|
-
*/
|
|
106
|
-
on(event: 'change', listener: SuiWalletEventListener): () => void;
|
|
107
|
-
/**
|
|
108
|
-
* Wallet Standard features property.
|
|
109
|
-
* Required by @mysten/wallet-standard registerWallet.
|
|
110
|
-
*/
|
|
111
|
-
get features(): {
|
|
112
|
-
readonly 'standard:connect': {
|
|
113
|
-
readonly version: "1.0.0";
|
|
114
|
-
readonly connect: (input?: SuiConnectInput) => Promise<SuiConnectOutput>;
|
|
115
|
-
};
|
|
116
|
-
readonly 'standard:disconnect': {
|
|
117
|
-
readonly version: "1.0.0";
|
|
118
|
-
readonly disconnect: () => Promise<void>;
|
|
119
|
-
};
|
|
120
|
-
readonly 'standard:events': {
|
|
121
|
-
readonly version: "1.0.0";
|
|
122
|
-
readonly on: (event: "change", listener: SuiWalletEventListener) => () => void;
|
|
123
|
-
};
|
|
124
|
-
readonly 'sui:signPersonalMessage': {
|
|
125
|
-
readonly version: "1.1.0";
|
|
126
|
-
readonly signPersonalMessage: (input: SuiSignPersonalMessageInput) => Promise<SuiSignPersonalMessageOutput>;
|
|
127
|
-
};
|
|
128
|
-
readonly 'sui:signTransaction': {
|
|
129
|
-
readonly version: "2.0.0";
|
|
130
|
-
readonly signTransaction: (input: {
|
|
131
|
-
transaction: unknown;
|
|
132
|
-
account: SuiAccount;
|
|
133
|
-
chain?: SuiChain;
|
|
134
|
-
}) => Promise<{
|
|
135
|
-
bytes: string;
|
|
136
|
-
signature: string;
|
|
137
|
-
}>;
|
|
138
|
-
};
|
|
139
|
-
readonly 'sui:signAndExecuteTransaction': {
|
|
140
|
-
readonly version: "1.0.0";
|
|
141
|
-
readonly signAndExecuteTransaction: (input: SuiSignAndExecuteTransactionInput) => Promise<SuiSignAndExecuteTransactionOutput>;
|
|
142
|
-
};
|
|
143
|
-
readonly 'sui:signTransactionBlock': {
|
|
144
|
-
readonly version: "2.0.0";
|
|
145
|
-
readonly signTransactionBlock: (input: SuiSignTransactionBlockInput) => Promise<SuiSignTransactionBlockOutput>;
|
|
146
|
-
};
|
|
147
|
-
readonly 'sui:signAndExecuteTransactionBlock': {
|
|
148
|
-
readonly version: "1.0.0";
|
|
149
|
-
readonly signAndExecuteTransactionBlock: (input: SuiSignAndExecuteTransactionBlockInput) => Promise<SuiSignAndExecuteTransactionBlockOutput>;
|
|
150
|
-
};
|
|
151
|
-
readonly 'sui:switchChain': {
|
|
152
|
-
readonly version: "1.0.0";
|
|
153
|
-
readonly switchChain: (input: {
|
|
154
|
-
chain: SuiChain;
|
|
155
|
-
}) => Promise<void>;
|
|
156
|
-
};
|
|
157
|
-
};
|
|
158
|
-
/**
|
|
159
|
-
* Legacy method for signing a transaction block.
|
|
160
|
-
* Maps to signTransaction.
|
|
161
|
-
*/
|
|
162
|
-
signTransactionBlock(input: SuiSignTransactionBlockInput): Promise<SuiSignTransactionBlockOutput>;
|
|
163
|
-
/**
|
|
164
|
-
* Legacy method for signing and executing a transaction block.
|
|
165
|
-
* Maps to signAndExecuteTransaction.
|
|
166
|
-
*/
|
|
167
|
-
signAndExecuteTransactionBlock(input: SuiSignAndExecuteTransactionBlockInput): Promise<SuiSignAndExecuteTransactionBlockOutput>;
|
|
168
|
-
/**
|
|
169
|
-
* Request the user's email address.
|
|
170
|
-
*
|
|
171
|
-
* @returns Promise resolving to the user's email address
|
|
172
|
-
*/
|
|
173
|
-
requestEmail(): Promise<string>;
|
|
174
|
-
/**
|
|
175
|
-
* Post a request to the iframe and wait for response.
|
|
176
|
-
*/
|
|
177
|
-
private postRequestAndWait;
|
|
178
|
-
/**
|
|
179
|
-
* Notify all change listeners.
|
|
180
|
-
*/
|
|
181
|
-
private notifyChange;
|
|
182
|
-
}
|
package/dist/lib/sui/index.d.ts
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Sui Wallet Standard integration for WaaP.
|
|
3
|
-
*/
|
|
4
|
-
export { WaaPSuiWallet } from './SuiWallet.js';
|
|
5
|
-
export { initWaaPSui } from './init.js';
|
|
6
|
-
export { registerWaaPSuiWallet } from './register.js';
|
|
7
|
-
export type { SuiAccount, SuiChain, SuiConnectInput, SuiConnectOutput, SuiSignPersonalMessageInput, SuiSignPersonalMessageOutput, SuiSignTransactionInput, SuiSignTransactionOutput, SuiWalletChangeProperties, SuiWalletEventListener, WaaPSuiWalletInterface, WaaPSuiWalletFeatures, InitWaaPSuiOptions, WalletIcon } from './types.js';
|
package/dist/lib/sui/init.d.ts
DELETED
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Initialization function for WaaP Sui Wallet.
|
|
3
|
-
*/
|
|
4
|
-
import type { InitWaaPSuiOptions, WaaPSuiWalletInterface } from './types.js';
|
|
5
|
-
/**
|
|
6
|
-
* Initialize WaaP Sui Wallet.
|
|
7
|
-
*
|
|
8
|
-
* This creates the WaaP iframe (if needed) and returns a SuiWallet instance
|
|
9
|
-
* that implements the Sui Wallet Standard.
|
|
10
|
-
*
|
|
11
|
-
* @param options - Initialization options
|
|
12
|
-
* @returns WaaPSuiWallet instance
|
|
13
|
-
*
|
|
14
|
-
* @example
|
|
15
|
-
* ```typescript
|
|
16
|
-
* import { initWaaPSui } from '@silk-wallet/silk-wallet-sdk'
|
|
17
|
-
*
|
|
18
|
-
* const suiWallet = initWaaPSui()
|
|
19
|
-
*
|
|
20
|
-
* // Connect to get accounts
|
|
21
|
-
* const { accounts } = await suiWallet.connect()
|
|
22
|
-
*
|
|
23
|
-
* // Sign a message
|
|
24
|
-
* const result = await suiWallet.signPersonalMessage({
|
|
25
|
-
* message: new TextEncoder().encode('Hello, Sui!'),
|
|
26
|
-
* account: accounts[0]
|
|
27
|
-
* })
|
|
28
|
-
* ```
|
|
29
|
-
*/
|
|
30
|
-
export declare function initWaaPSui(options?: InitWaaPSuiOptions): WaaPSuiWalletInterface;
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* WaaP Sui Wallet Registration
|
|
3
|
-
*
|
|
4
|
-
* Registers the WaaP Sui wallet with the Wallet Standard registry,
|
|
5
|
-
* making it discoverable by dApps using @mysten/dapp-kit.
|
|
6
|
-
*
|
|
7
|
-
* @see https://docs.sui.io/standards/wallet-standard
|
|
8
|
-
*/
|
|
9
|
-
import type { InitWaaPSuiOptions, WaaPSuiWalletInterface } from './types.js';
|
|
10
|
-
/**
|
|
11
|
-
* Register WaaP Sui Wallet with the Wallet Standard.
|
|
12
|
-
*
|
|
13
|
-
* This makes the wallet discoverable by dApps using @mysten/dapp-kit.
|
|
14
|
-
* The wallet will appear in the wallet selection UI of any dApp
|
|
15
|
-
* that uses the Sui Wallet Standard.
|
|
16
|
-
*
|
|
17
|
-
* @param iframeWindow - The contentWindow of the WaaP iframe
|
|
18
|
-
* @param options - Initialization options
|
|
19
|
-
* @returns The registered WaaPSuiWallet instance
|
|
20
|
-
*
|
|
21
|
-
* @example
|
|
22
|
-
* ```typescript
|
|
23
|
-
* import { registerWaaPSuiWallet } from '@silk-wallet/silk-wallet-sdk'
|
|
24
|
-
*
|
|
25
|
-
* // Get the iframe element
|
|
26
|
-
* const iframe = document.getElementById('waap-wallet-iframe') as HTMLIFrameElement
|
|
27
|
-
*
|
|
28
|
-
* // Register the wallet (makes it discoverable by dApps)
|
|
29
|
-
* const wallet = registerWaaPSuiWallet(iframe.contentWindow!, { useStaging: false })
|
|
30
|
-
*
|
|
31
|
-
* // The wallet is now available in dapp-kit's wallet list
|
|
32
|
-
* ```
|
|
33
|
-
*/
|
|
34
|
-
export declare function registerWaaPSuiWallet(iframeWindow: Window, options?: InitWaaPSuiOptions): WaaPSuiWalletInterface;
|
|
35
|
-
/**
|
|
36
|
-
* Unregister callback type returned by registerWallet.
|
|
37
|
-
* Can be called to remove the wallet from the registry.
|
|
38
|
-
*/
|
|
39
|
-
export type UnregisterWallet = () => void;
|
package/dist/lib/sui/types.d.ts
DELETED
|
@@ -1,284 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Type definitions for Sui Wallet Standard integration.
|
|
3
|
-
*
|
|
4
|
-
* @see https://docs.sui.io/standards/wallet-standard
|
|
5
|
-
*/
|
|
6
|
-
/**
|
|
7
|
-
* Sui chain identifiers.
|
|
8
|
-
*/
|
|
9
|
-
export type SuiChain = 'sui:mainnet' | 'sui:testnet' | 'sui:devnet' | 'sui:localnet';
|
|
10
|
-
/**
|
|
11
|
-
* Sui account representation following Wallet Standard.
|
|
12
|
-
*/
|
|
13
|
-
export interface SuiAccount {
|
|
14
|
-
/** Sui address (32 bytes, 0x-prefixed hex string) */
|
|
15
|
-
readonly address: string;
|
|
16
|
-
/** Compressed public key bytes (33 bytes for Secp256k1) */
|
|
17
|
-
readonly publicKey: Uint8Array;
|
|
18
|
-
/** Supported chains for this account */
|
|
19
|
-
readonly chains: readonly SuiChain[];
|
|
20
|
-
/** Supported features for this account */
|
|
21
|
-
readonly features: readonly string[];
|
|
22
|
-
/** Optional display label */
|
|
23
|
-
readonly label?: string;
|
|
24
|
-
}
|
|
25
|
-
/**
|
|
26
|
-
* Input for sui:signPersonalMessage feature.
|
|
27
|
-
*/
|
|
28
|
-
export interface SuiSignPersonalMessageInput {
|
|
29
|
-
/** Message bytes to sign */
|
|
30
|
-
message: Uint8Array;
|
|
31
|
-
/** Account to sign with */
|
|
32
|
-
account: SuiAccount;
|
|
33
|
-
/** Optional chain identifier */
|
|
34
|
-
chain?: SuiChain;
|
|
35
|
-
}
|
|
36
|
-
/**
|
|
37
|
-
* Output from sui:signPersonalMessage feature.
|
|
38
|
-
*/
|
|
39
|
-
export interface SuiSignPersonalMessageOutput {
|
|
40
|
-
/** Base64-encoded message bytes */
|
|
41
|
-
bytes: string;
|
|
42
|
-
/** Base64-encoded signature (98 bytes for Secp256k1) */
|
|
43
|
-
signature: string;
|
|
44
|
-
}
|
|
45
|
-
/**
|
|
46
|
-
* Input for sui:signTransaction feature.
|
|
47
|
-
*/
|
|
48
|
-
export interface SuiSignTransactionInput {
|
|
49
|
-
/** BCS-serialized transaction bytes */
|
|
50
|
-
transaction: Uint8Array;
|
|
51
|
-
/** Account to sign with */
|
|
52
|
-
account: SuiAccount;
|
|
53
|
-
/** Optional chain identifier */
|
|
54
|
-
chain?: SuiChain;
|
|
55
|
-
}
|
|
56
|
-
/**
|
|
57
|
-
* Output from sui:signTransaction feature.
|
|
58
|
-
*/
|
|
59
|
-
export interface SuiSignTransactionOutput {
|
|
60
|
-
/** Base64-encoded transaction bytes */
|
|
61
|
-
bytes: string;
|
|
62
|
-
/** Base64-encoded signature */
|
|
63
|
-
signature: string;
|
|
64
|
-
}
|
|
65
|
-
/**
|
|
66
|
-
* Input for sui:signAndExecuteTransaction feature.
|
|
67
|
-
*/
|
|
68
|
-
export interface SuiSignAndExecuteTransactionInput {
|
|
69
|
-
/** BCS-serialized transaction bytes */
|
|
70
|
-
transaction: Uint8Array;
|
|
71
|
-
/** Account to sign with */
|
|
72
|
-
account: SuiAccount;
|
|
73
|
-
/** Optional chain identifier */
|
|
74
|
-
chain?: SuiChain;
|
|
75
|
-
/** Options for execution */
|
|
76
|
-
options?: unknown;
|
|
77
|
-
/** Request type */
|
|
78
|
-
requestType?: 'WaitForEffectsCert' | 'WaitForLocalExecution';
|
|
79
|
-
}
|
|
80
|
-
/**
|
|
81
|
-
* Output from sui:signAndExecuteTransaction feature.
|
|
82
|
-
*/
|
|
83
|
-
export interface SuiSignAndExecuteTransactionOutput {
|
|
84
|
-
digest: string;
|
|
85
|
-
effects?: unknown;
|
|
86
|
-
errors?: unknown[];
|
|
87
|
-
[key: string]: unknown;
|
|
88
|
-
}
|
|
89
|
-
/**
|
|
90
|
-
* Connect input options.
|
|
91
|
-
*/
|
|
92
|
-
export interface SuiConnectInput {
|
|
93
|
-
/** If true, attempt silent connection without UI prompt */
|
|
94
|
-
silent?: boolean;
|
|
95
|
-
}
|
|
96
|
-
/**
|
|
97
|
-
* Connect output with accounts.
|
|
98
|
-
*/
|
|
99
|
-
export interface SuiConnectOutput {
|
|
100
|
-
/** Connected accounts */
|
|
101
|
-
accounts: readonly SuiAccount[];
|
|
102
|
-
}
|
|
103
|
-
/**
|
|
104
|
-
* Input for legacy sui:signTransactionBlock feature.
|
|
105
|
-
*/
|
|
106
|
-
export interface SuiSignTransactionBlockInput {
|
|
107
|
-
/** BCS-serialized transaction block bytes */
|
|
108
|
-
transactionBlock: Uint8Array;
|
|
109
|
-
/** Account to sign with */
|
|
110
|
-
account: SuiAccount;
|
|
111
|
-
/** Optional chain identifier */
|
|
112
|
-
chain?: SuiChain;
|
|
113
|
-
}
|
|
114
|
-
/**
|
|
115
|
-
* Output for legacy sui:signTransactionBlock feature.
|
|
116
|
-
*/
|
|
117
|
-
export interface SuiSignTransactionBlockOutput extends SuiSignTransactionOutput {
|
|
118
|
-
}
|
|
119
|
-
/**
|
|
120
|
-
* Input for legacy sui:signAndExecuteTransactionBlock feature.
|
|
121
|
-
*/
|
|
122
|
-
export interface SuiSignAndExecuteTransactionBlockInput {
|
|
123
|
-
/** BCS-serialized transaction block bytes */
|
|
124
|
-
transactionBlock: Uint8Array;
|
|
125
|
-
/** Account to sign with */
|
|
126
|
-
account: SuiAccount;
|
|
127
|
-
/** Optional chain identifier */
|
|
128
|
-
chain?: SuiChain;
|
|
129
|
-
/** Options for execution */
|
|
130
|
-
options?: unknown;
|
|
131
|
-
/** Request type */
|
|
132
|
-
requestType?: 'WaitForEffectsCert' | 'WaitForLocalExecution';
|
|
133
|
-
}
|
|
134
|
-
/**
|
|
135
|
-
* Output for legacy sui:signAndExecuteTransactionBlock feature.
|
|
136
|
-
*/
|
|
137
|
-
export interface SuiSignAndExecuteTransactionBlockOutput extends SuiSignAndExecuteTransactionOutput {
|
|
138
|
-
}
|
|
139
|
-
/**
|
|
140
|
-
* Wallet change event properties.
|
|
141
|
-
*/
|
|
142
|
-
export interface SuiWalletChangeProperties {
|
|
143
|
-
chains?: readonly SuiChain[];
|
|
144
|
-
accounts?: readonly SuiAccount[];
|
|
145
|
-
features?: Record<string, unknown>;
|
|
146
|
-
}
|
|
147
|
-
/**
|
|
148
|
-
* Event listener types.
|
|
149
|
-
*/
|
|
150
|
-
export type SuiWalletEventListener = (properties: SuiWalletChangeProperties) => void;
|
|
151
|
-
/**
|
|
152
|
-
* Wallet icon type (data URL).
|
|
153
|
-
*/
|
|
154
|
-
export type WalletIcon = `data:image/${'svg+xml' | 'webp' | 'png' | 'gif'};base64,${string}`;
|
|
155
|
-
/**
|
|
156
|
-
* Wallet Standard features object.
|
|
157
|
-
*/
|
|
158
|
-
export interface WaaPSuiWalletFeatures {
|
|
159
|
-
'standard:connect': {
|
|
160
|
-
version: '1.0.0';
|
|
161
|
-
connect: (input?: SuiConnectInput) => Promise<SuiConnectOutput>;
|
|
162
|
-
};
|
|
163
|
-
'standard:disconnect': {
|
|
164
|
-
version: '1.0.0';
|
|
165
|
-
disconnect: () => Promise<void>;
|
|
166
|
-
};
|
|
167
|
-
'standard:events': {
|
|
168
|
-
version: '1.0.0';
|
|
169
|
-
on: (event: 'change', listener: SuiWalletEventListener) => () => void;
|
|
170
|
-
};
|
|
171
|
-
'sui:signPersonalMessage': {
|
|
172
|
-
version: '1.1.0';
|
|
173
|
-
signPersonalMessage: (input: SuiSignPersonalMessageInput) => Promise<SuiSignPersonalMessageOutput>;
|
|
174
|
-
};
|
|
175
|
-
'sui:signTransaction': {
|
|
176
|
-
version: '2.0.0';
|
|
177
|
-
signTransaction: (input: SuiSignTransactionInput) => Promise<SuiSignTransactionOutput>;
|
|
178
|
-
};
|
|
179
|
-
'sui:switchChain': {
|
|
180
|
-
version: '1.0.0';
|
|
181
|
-
switchChain: (input: {
|
|
182
|
-
chain: SuiChain;
|
|
183
|
-
}) => Promise<void>;
|
|
184
|
-
};
|
|
185
|
-
'sui:signAndExecuteTransaction': {
|
|
186
|
-
version: '1.0.0';
|
|
187
|
-
signAndExecuteTransaction: (input: SuiSignAndExecuteTransactionInput) => Promise<SuiSignAndExecuteTransactionOutput>;
|
|
188
|
-
};
|
|
189
|
-
'sui:signTransactionBlock': {
|
|
190
|
-
version: '2.0.0';
|
|
191
|
-
signTransactionBlock: (input: SuiSignTransactionBlockInput) => Promise<SuiSignTransactionBlockOutput>;
|
|
192
|
-
};
|
|
193
|
-
'sui:signAndExecuteTransactionBlock': {
|
|
194
|
-
version: '1.0.0';
|
|
195
|
-
signAndExecuteTransactionBlock: (input: SuiSignAndExecuteTransactionBlockInput) => Promise<SuiSignAndExecuteTransactionBlockOutput>;
|
|
196
|
-
};
|
|
197
|
-
}
|
|
198
|
-
/**
|
|
199
|
-
* WaaP Sui Wallet interface.
|
|
200
|
-
*/
|
|
201
|
-
export interface WaaPSuiWalletInterface {
|
|
202
|
-
/** Wallet name */
|
|
203
|
-
readonly name: string;
|
|
204
|
-
/** Wallet version */
|
|
205
|
-
readonly version: string;
|
|
206
|
-
/** Wallet icon */
|
|
207
|
-
readonly icon: WalletIcon;
|
|
208
|
-
/** Supported chains */
|
|
209
|
-
readonly chains: readonly SuiChain[];
|
|
210
|
-
/** Connected accounts */
|
|
211
|
-
readonly accounts: readonly SuiAccount[];
|
|
212
|
-
/** Wallet Standard features */
|
|
213
|
-
readonly features: WaaPSuiWalletFeatures;
|
|
214
|
-
/**
|
|
215
|
-
* Connect to the wallet.
|
|
216
|
-
*/
|
|
217
|
-
connect(input?: SuiConnectInput): Promise<SuiConnectOutput>;
|
|
218
|
-
/**
|
|
219
|
-
* Disconnect from the wallet.
|
|
220
|
-
*/
|
|
221
|
-
disconnect(): Promise<void>;
|
|
222
|
-
/**
|
|
223
|
-
* Switch the active chain.
|
|
224
|
-
*/
|
|
225
|
-
switchChain(input: {
|
|
226
|
-
chain: SuiChain;
|
|
227
|
-
}): Promise<void>;
|
|
228
|
-
/**
|
|
229
|
-
* Sign a personal message.
|
|
230
|
-
*/
|
|
231
|
-
signPersonalMessage(input: SuiSignPersonalMessageInput): Promise<SuiSignPersonalMessageOutput>;
|
|
232
|
-
/**
|
|
233
|
-
* Sign and execute a transaction.
|
|
234
|
-
*/
|
|
235
|
-
signAndExecuteTransaction(input: SuiSignAndExecuteTransactionInput): Promise<SuiSignAndExecuteTransactionOutput>;
|
|
236
|
-
/**
|
|
237
|
-
* Sign a transaction block (Legacy).
|
|
238
|
-
*/
|
|
239
|
-
signTransactionBlock(input: SuiSignTransactionBlockInput): Promise<SuiSignTransactionBlockOutput>;
|
|
240
|
-
/**
|
|
241
|
-
* Sign and execute a transaction block (Legacy).
|
|
242
|
-
*/
|
|
243
|
-
signAndExecuteTransactionBlock(input: SuiSignAndExecuteTransactionBlockInput): Promise<SuiSignAndExecuteTransactionBlockOutput>;
|
|
244
|
-
/**
|
|
245
|
-
* Subscribe to wallet events.
|
|
246
|
-
* @returns Unsubscribe function
|
|
247
|
-
*/
|
|
248
|
-
on(event: 'change', listener: SuiWalletEventListener): () => void;
|
|
249
|
-
/** custom WaaP features */
|
|
250
|
-
/**
|
|
251
|
-
* Request the user's email address.
|
|
252
|
-
* @returns Promise resolving to the user's email address
|
|
253
|
-
*/
|
|
254
|
-
requestEmail(): Promise<string>;
|
|
255
|
-
}
|
|
256
|
-
/**
|
|
257
|
-
* Initialization options for WaaP Sui Wallet.
|
|
258
|
-
*/
|
|
259
|
-
import type { CustomConfig, ProjectConfig, AuthenticationMethod } from '@human.tech/waap-interface-core';
|
|
260
|
-
/**
|
|
261
|
-
* Sui-supported authentication methods (no 'wallet/walletconnect' support yet)
|
|
262
|
-
* Also it is not necessary as @mysten/dapp-kit handles wallet choices
|
|
263
|
-
* todo: maybe add a modal to list out Sui wallets discovered as per Wallet Standard
|
|
264
|
-
*/
|
|
265
|
-
export type SuiAuthenticationMethod = Exclude<AuthenticationMethod, 'wallet'>;
|
|
266
|
-
/**
|
|
267
|
-
* Sui-specific custom configuration
|
|
268
|
-
*/
|
|
269
|
-
export interface SuiCustomConfig extends Omit<CustomConfig, 'authenticationMethods'> {
|
|
270
|
-
authenticationMethods?: SuiAuthenticationMethod[];
|
|
271
|
-
}
|
|
272
|
-
/**
|
|
273
|
-
* Initialization options for WaaP Sui Wallet.
|
|
274
|
-
*/
|
|
275
|
-
export interface InitWaaPSuiOptions {
|
|
276
|
-
/** Use staging environment */
|
|
277
|
-
useStaging?: boolean;
|
|
278
|
-
/** WaaP points referral code */
|
|
279
|
-
referralCode?: string;
|
|
280
|
-
/** WaaP project configuration */
|
|
281
|
-
project?: ProjectConfig;
|
|
282
|
-
/** WaaP custom UI configuration */
|
|
283
|
-
config?: SuiCustomConfig;
|
|
284
|
-
}
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* WaaP Component
|
|
3
|
-
*
|
|
4
|
-
* A custom HTML element that allows developers to control where the WaaP wallet
|
|
5
|
-
* renders in their UI. When present, the wallet will render inside this component
|
|
6
|
-
* instead of as a centered modal with backdrop.
|
|
7
|
-
*
|
|
8
|
-
* Usage in HTML:
|
|
9
|
-
* ```html
|
|
10
|
-
* <waap-wallet></waap-wallet>
|
|
11
|
-
* ```
|
|
12
|
-
*
|
|
13
|
-
* Usage in React/JSX:
|
|
14
|
-
* ```tsx
|
|
15
|
-
* function App() {
|
|
16
|
-
* return <waap-wallet style={{ width: '400px', height: '600px' }} />
|
|
17
|
-
* }
|
|
18
|
-
* ```
|
|
19
|
-
*/
|
|
20
|
-
/**
|
|
21
|
-
* Custom HTML element for WaaP wallet
|
|
22
|
-
* Only defined in browser environments to avoid SSR issues
|
|
23
|
-
*/
|
|
24
|
-
declare let WaapWalletElement: any;
|
|
25
|
-
/**
|
|
26
|
-
* Check if a WaaP component exists in the DOM (internal use)
|
|
27
|
-
*/
|
|
28
|
-
export declare function hasWaapComponent(): boolean;
|
|
29
|
-
/**
|
|
30
|
-
* Get the WaaP component container element (internal use)
|
|
31
|
-
*/
|
|
32
|
-
export declare function getWaapComponentContainer(): HTMLElement | null;
|
|
33
|
-
/**
|
|
34
|
-
* Export the custom element class for advanced use cases
|
|
35
|
-
* Most users won't need this - just use <waap-wallet> in your HTML/JSX
|
|
36
|
-
*/
|
|
37
|
-
export { WaapWalletElement as WaaP };
|