@dynamic-labs/waas-sui 4.12.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 +5297 -0
- package/LICENSE +21 -0
- package/README.md +7 -0
- package/_virtual/_tslib.cjs +36 -0
- package/_virtual/_tslib.js +32 -0
- package/package.cjs +8 -0
- package/package.js +4 -0
- package/package.json +33 -0
- package/src/DynamicWaasSuiConnectors.cjs +10 -0
- package/src/DynamicWaasSuiConnectors.d.ts +2 -0
- package/src/DynamicWaasSuiConnectors.js +6 -0
- package/src/connector/DynamicWaasSuiConnector.cjs +232 -0
- package/src/connector/DynamicWaasSuiConnector.d.ts +56 -0
- package/src/connector/DynamicWaasSuiConnector.js +228 -0
- package/src/index.cjs +14 -0
- package/src/index.d.ts +2 -0
- package/src/index.js +7 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2022 Dynamic Labs, Inc.
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
5
|
+
|
|
6
|
+
/******************************************************************************
|
|
7
|
+
Copyright (c) Microsoft Corporation.
|
|
8
|
+
|
|
9
|
+
Permission to use, copy, modify, and/or distribute this software for any
|
|
10
|
+
purpose with or without fee is hereby granted.
|
|
11
|
+
|
|
12
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
13
|
+
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
14
|
+
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
15
|
+
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
16
|
+
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
17
|
+
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
18
|
+
PERFORMANCE OF THIS SOFTWARE.
|
|
19
|
+
***************************************************************************** */
|
|
20
|
+
|
|
21
|
+
function __awaiter(thisArg, _arguments, P, generator) {
|
|
22
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
23
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
24
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
25
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
26
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
27
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
|
|
32
|
+
var e = new Error(message);
|
|
33
|
+
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
exports.__awaiter = __awaiter;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
/******************************************************************************
|
|
3
|
+
Copyright (c) Microsoft Corporation.
|
|
4
|
+
|
|
5
|
+
Permission to use, copy, modify, and/or distribute this software for any
|
|
6
|
+
purpose with or without fee is hereby granted.
|
|
7
|
+
|
|
8
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
9
|
+
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
10
|
+
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
11
|
+
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
12
|
+
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
13
|
+
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
14
|
+
PERFORMANCE OF THIS SOFTWARE.
|
|
15
|
+
***************************************************************************** */
|
|
16
|
+
|
|
17
|
+
function __awaiter(thisArg, _arguments, P, generator) {
|
|
18
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
19
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
20
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
21
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
22
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
23
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
|
|
28
|
+
var e = new Error(message);
|
|
29
|
+
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
export { __awaiter };
|
package/package.cjs
ADDED
package/package.js
ADDED
package/package.json
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@dynamic-labs/waas-sui",
|
|
3
|
+
"version": "4.12.0",
|
|
4
|
+
"description": "A React SDK for implementing wallet web3 authentication and authorization to your website.",
|
|
5
|
+
"author": "Dynamic Labs, Inc.",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"main": "./src/index.cjs",
|
|
8
|
+
"module": "./src/index.js",
|
|
9
|
+
"types": "./src/index.d.ts",
|
|
10
|
+
"type": "module",
|
|
11
|
+
"exports": {
|
|
12
|
+
".": {
|
|
13
|
+
"types": "./src/index.d.ts",
|
|
14
|
+
"import": "./src/index.js",
|
|
15
|
+
"require": "./src/index.cjs"
|
|
16
|
+
},
|
|
17
|
+
"./package.json": "./package.json"
|
|
18
|
+
},
|
|
19
|
+
"homepage": "https://www.dynamic.xyz/",
|
|
20
|
+
"dependencies": {
|
|
21
|
+
"@dynamic-labs-wallet/sui": "0.0.60",
|
|
22
|
+
"@mysten/sui": "1.24.0",
|
|
23
|
+
"@mysten/wallet-standard": "0.13.29",
|
|
24
|
+
"@dynamic-labs/sui": "4.12.0",
|
|
25
|
+
"@dynamic-labs/assert-package-version": "4.12.0",
|
|
26
|
+
"@dynamic-labs/logger": "4.12.0",
|
|
27
|
+
"@dynamic-labs/rpc-providers": "4.12.0",
|
|
28
|
+
"@dynamic-labs/utils": "4.12.0",
|
|
29
|
+
"@dynamic-labs/wallet-book": "4.12.0",
|
|
30
|
+
"@dynamic-labs/wallet-connector-core": "4.12.0"
|
|
31
|
+
},
|
|
32
|
+
"peerDependencies": {}
|
|
33
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
5
|
+
|
|
6
|
+
var DynamicWaasSuiConnector = require('./connector/DynamicWaasSuiConnector.cjs');
|
|
7
|
+
|
|
8
|
+
const DynamicWaasSuiConnectors = () => [DynamicWaasSuiConnector.DynamicWaasSuiConnector];
|
|
9
|
+
|
|
10
|
+
exports.DynamicWaasSuiConnectors = DynamicWaasSuiConnectors;
|
|
@@ -0,0 +1,232 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
5
|
+
|
|
6
|
+
var _tslib = require('../../_virtual/_tslib.cjs');
|
|
7
|
+
var sui$1 = require('@dynamic-labs-wallet/sui');
|
|
8
|
+
var client = require('@mysten/sui/client');
|
|
9
|
+
var walletConnectorCore = require('@dynamic-labs/wallet-connector-core');
|
|
10
|
+
var utils = require('@dynamic-labs/utils');
|
|
11
|
+
var sui = require('@dynamic-labs/sui');
|
|
12
|
+
|
|
13
|
+
class DynamicWaasSuiConnector extends sui.SuiWalletConnector {
|
|
14
|
+
constructor(props) {
|
|
15
|
+
super('Dynamic Waas', props);
|
|
16
|
+
this.switchNetworkOnlyFromWallet = false;
|
|
17
|
+
this.name = 'Dynamic Waas';
|
|
18
|
+
this.overrideKey = 'dynamicwaas';
|
|
19
|
+
this.isEmbeddedWallet = true;
|
|
20
|
+
}
|
|
21
|
+
connect() {
|
|
22
|
+
return _tslib.__awaiter(this, void 0, void 0, function* () {
|
|
23
|
+
this.getWaasWalletClient();
|
|
24
|
+
this.activeNetworkId = '501'; // default to mainnet
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
getNetwork() {
|
|
28
|
+
return _tslib.__awaiter(this, void 0, void 0, function* () {
|
|
29
|
+
if (!this.activeNetworkId) {
|
|
30
|
+
this.activeNetworkId = '501'; // fallback to mainnet
|
|
31
|
+
}
|
|
32
|
+
return this.activeNetworkId;
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
getNetworkName() {
|
|
36
|
+
return _tslib.__awaiter(this, void 0, void 0, function* () {
|
|
37
|
+
const networkId = yield this.getNetwork();
|
|
38
|
+
if (!networkId) {
|
|
39
|
+
throw new utils.DynamicError('Missing network id');
|
|
40
|
+
}
|
|
41
|
+
switch (networkId) {
|
|
42
|
+
case '501':
|
|
43
|
+
return 'mainnet';
|
|
44
|
+
case '502':
|
|
45
|
+
return 'testnet';
|
|
46
|
+
case '503':
|
|
47
|
+
return 'devnet';
|
|
48
|
+
default:
|
|
49
|
+
throw new utils.DynamicError(`Unsupported network: ${networkId}`);
|
|
50
|
+
}
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
switchNetwork(_a) {
|
|
54
|
+
return _tslib.__awaiter(this, arguments, void 0, function* ({ networkChainId, }) {
|
|
55
|
+
if (!networkChainId)
|
|
56
|
+
return;
|
|
57
|
+
const networkIdString = networkChainId.toString();
|
|
58
|
+
const isValidNetwork = this.suiNetworks.some((network) => network.networkId === networkIdString);
|
|
59
|
+
if (!isValidNetwork) {
|
|
60
|
+
throw new utils.DynamicError(`Network ${networkIdString} is not supported`);
|
|
61
|
+
}
|
|
62
|
+
this.activeNetworkId = networkIdString;
|
|
63
|
+
this.emit('chainChange', { chain: networkIdString });
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
supportsNetworkSwitching() {
|
|
67
|
+
return true;
|
|
68
|
+
}
|
|
69
|
+
setGetAuthTokenFunction(getAuthToken) {
|
|
70
|
+
this.getAuthToken = getAuthToken;
|
|
71
|
+
}
|
|
72
|
+
setEnvironmentId(environmentId) {
|
|
73
|
+
this.environmentId = environmentId;
|
|
74
|
+
}
|
|
75
|
+
setBaseApiUrl(baseApiUrl) {
|
|
76
|
+
this.baseApiUrl = baseApiUrl;
|
|
77
|
+
}
|
|
78
|
+
setRelayUrl(relayUrl) {
|
|
79
|
+
this.relayUrl = relayUrl;
|
|
80
|
+
}
|
|
81
|
+
setActiveAccountAddress(accountAddress) {
|
|
82
|
+
this.activeAccountAddress = accountAddress;
|
|
83
|
+
}
|
|
84
|
+
createDynamicWaasClient() {
|
|
85
|
+
var _a;
|
|
86
|
+
const authToken = (_a = this.getAuthToken) === null || _a === void 0 ? void 0 : _a.call(this);
|
|
87
|
+
if (!authToken) {
|
|
88
|
+
throw new Error('Auth token is required');
|
|
89
|
+
}
|
|
90
|
+
if (!this.environmentId) {
|
|
91
|
+
throw new Error('Environment ID is required');
|
|
92
|
+
}
|
|
93
|
+
return new sui$1.DynamicSuiWalletClient({
|
|
94
|
+
authToken,
|
|
95
|
+
baseApiUrl: this.baseApiUrl,
|
|
96
|
+
baseMPCRelayApiUrl: this.relayUrl || 'relay.dynamic-preprod.xyz',
|
|
97
|
+
environmentId: this.environmentId,
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
getWaasWalletClient() {
|
|
101
|
+
if (!this.dynamicWaasClient) {
|
|
102
|
+
this.dynamicWaasClient = this.createDynamicWaasClient();
|
|
103
|
+
}
|
|
104
|
+
return this.dynamicWaasClient;
|
|
105
|
+
}
|
|
106
|
+
validateActiveWallet(expectedAddress) {
|
|
107
|
+
return _tslib.__awaiter(this, void 0, void 0, function* () {
|
|
108
|
+
const waasSuiClient = this.getWaasWalletClient();
|
|
109
|
+
const targetWallet = yield waasSuiClient.getWallet({
|
|
110
|
+
accountAddress: expectedAddress,
|
|
111
|
+
});
|
|
112
|
+
if (!targetWallet) {
|
|
113
|
+
throw new utils.DynamicError('Account not found');
|
|
114
|
+
}
|
|
115
|
+
const isWalletActive = walletConnectorCore.isSameAddress(targetWallet.accountAddress, this.activeAccountAddress || '', this.connectedChain);
|
|
116
|
+
if (!isWalletActive) {
|
|
117
|
+
this.activeAccountAddress = targetWallet.accountAddress;
|
|
118
|
+
}
|
|
119
|
+
});
|
|
120
|
+
}
|
|
121
|
+
createWalletAccount() {
|
|
122
|
+
return _tslib.__awaiter(this, arguments, void 0, function* ({ thresholdSignatureScheme = 'TWO_OF_TWO', } = {}) {
|
|
123
|
+
const walletClient = this.getWaasWalletClient();
|
|
124
|
+
const createdWallet = yield walletClient.createWalletAccount({
|
|
125
|
+
thresholdSignatureScheme: thresholdSignatureScheme,
|
|
126
|
+
});
|
|
127
|
+
return createdWallet;
|
|
128
|
+
});
|
|
129
|
+
}
|
|
130
|
+
signMessage(message) {
|
|
131
|
+
return _tslib.__awaiter(this, void 0, void 0, function* () {
|
|
132
|
+
const waasSuiClient = this.getWaasWalletClient();
|
|
133
|
+
if (!this.activeAccountAddress) {
|
|
134
|
+
throw new Error('Active account address is required');
|
|
135
|
+
}
|
|
136
|
+
const signedMessage = yield waasSuiClient.signMessage({
|
|
137
|
+
accountAddress: this.activeAccountAddress,
|
|
138
|
+
message,
|
|
139
|
+
});
|
|
140
|
+
return signedMessage;
|
|
141
|
+
});
|
|
142
|
+
}
|
|
143
|
+
createAndSignTransaction(transaction) {
|
|
144
|
+
return _tslib.__awaiter(this, void 0, void 0, function* () {
|
|
145
|
+
const networkName = yield this.getNetworkName();
|
|
146
|
+
const client$1 = new client.SuiClient({ url: client.getFullnodeUrl(networkName) });
|
|
147
|
+
const txBytes = yield transaction.build({ client: client$1 });
|
|
148
|
+
const txString = Buffer.from(txBytes).toString('hex');
|
|
149
|
+
const walletClient = this.getWaasWalletClient();
|
|
150
|
+
if (!this.activeAccountAddress) {
|
|
151
|
+
throw new Error('Active account address is required');
|
|
152
|
+
}
|
|
153
|
+
const signedTx = yield walletClient.signTransaction({
|
|
154
|
+
accountAddress: this.activeAccountAddress,
|
|
155
|
+
message: txString,
|
|
156
|
+
});
|
|
157
|
+
return {
|
|
158
|
+
client: client$1,
|
|
159
|
+
signedTx: {
|
|
160
|
+
bytes: txBytes,
|
|
161
|
+
signature: signedTx,
|
|
162
|
+
},
|
|
163
|
+
};
|
|
164
|
+
});
|
|
165
|
+
}
|
|
166
|
+
signTransaction(transaction) {
|
|
167
|
+
return _tslib.__awaiter(this, void 0, void 0, function* () {
|
|
168
|
+
try {
|
|
169
|
+
const { signedTx } = yield this.createAndSignTransaction(transaction);
|
|
170
|
+
return signedTx;
|
|
171
|
+
}
|
|
172
|
+
catch (error) {
|
|
173
|
+
throw new Error('Failed to sign transaction', {
|
|
174
|
+
cause: error,
|
|
175
|
+
});
|
|
176
|
+
}
|
|
177
|
+
});
|
|
178
|
+
}
|
|
179
|
+
signAndExecuteTransaction(transaction) {
|
|
180
|
+
return _tslib.__awaiter(this, void 0, void 0, function* () {
|
|
181
|
+
try {
|
|
182
|
+
const { signedTx, client } = yield this.createAndSignTransaction(transaction);
|
|
183
|
+
return client.executeTransactionBlock({
|
|
184
|
+
signature: signedTx.signature,
|
|
185
|
+
transactionBlock: signedTx.bytes,
|
|
186
|
+
});
|
|
187
|
+
}
|
|
188
|
+
catch (error) {
|
|
189
|
+
throw new Error('Failed to sign and execute transaction', {
|
|
190
|
+
cause: error,
|
|
191
|
+
});
|
|
192
|
+
}
|
|
193
|
+
});
|
|
194
|
+
}
|
|
195
|
+
getSuiClient() {
|
|
196
|
+
return _tslib.__awaiter(this, void 0, void 0, function* () {
|
|
197
|
+
const networkName = yield this.getNetworkName();
|
|
198
|
+
return new client.SuiClient({ url: client.getFullnodeUrl(networkName) });
|
|
199
|
+
});
|
|
200
|
+
}
|
|
201
|
+
getWalletClientByAddress({ accountAddress, }) {
|
|
202
|
+
this.setActiveAccountAddress(accountAddress);
|
|
203
|
+
return this.getWaasWalletClient();
|
|
204
|
+
}
|
|
205
|
+
getWalletClient() {
|
|
206
|
+
return this.getWaasWalletClient();
|
|
207
|
+
}
|
|
208
|
+
exportPrivateKey() {
|
|
209
|
+
return _tslib.__awaiter(this, void 0, void 0, function* () {
|
|
210
|
+
// TODO: implement
|
|
211
|
+
});
|
|
212
|
+
}
|
|
213
|
+
importPrivateKey() {
|
|
214
|
+
return _tslib.__awaiter(this, void 0, void 0, function* () {
|
|
215
|
+
// TODO: implement
|
|
216
|
+
});
|
|
217
|
+
}
|
|
218
|
+
exportClientKeyshares(_a) {
|
|
219
|
+
return _tslib.__awaiter(this, arguments, void 0, function* ({ accountAddress, }) {
|
|
220
|
+
const waasSuiClient = this.getWaasWalletClient();
|
|
221
|
+
const targetAccountAddress = accountAddress || this.activeAccountAddress;
|
|
222
|
+
if (!targetAccountAddress) {
|
|
223
|
+
throw new Error('Account address is required');
|
|
224
|
+
}
|
|
225
|
+
yield waasSuiClient.exportClientKeyshares({
|
|
226
|
+
accountAddress: targetAccountAddress,
|
|
227
|
+
});
|
|
228
|
+
});
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
exports.DynamicWaasSuiConnector = DynamicWaasSuiConnector;
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { DynamicSuiWalletClient } from '@dynamic-labs-wallet/sui';
|
|
2
|
+
import { SuiClient, SuiTransactionBlockResponse } from '@mysten/sui/client';
|
|
3
|
+
import { Transaction } from '@mysten/sui/transactions';
|
|
4
|
+
import { SignedTransaction } from '@mysten/wallet-standard';
|
|
5
|
+
import { IDynamicWaasConnector } from '@dynamic-labs/wallet-connector-core';
|
|
6
|
+
import { SuiWalletConnector, SuiWalletConnectorProps } from '@dynamic-labs/sui';
|
|
7
|
+
export declare class DynamicWaasSuiConnector extends SuiWalletConnector implements IDynamicWaasConnector {
|
|
8
|
+
switchNetworkOnlyFromWallet: boolean;
|
|
9
|
+
constructor(props: SuiWalletConnectorProps);
|
|
10
|
+
connect(): Promise<void>;
|
|
11
|
+
getNetwork(): Promise<string | undefined>;
|
|
12
|
+
getNetworkName(): Promise<'mainnet' | 'testnet' | 'devnet'>;
|
|
13
|
+
switchNetwork({ networkChainId, }: {
|
|
14
|
+
networkChainId: string | number;
|
|
15
|
+
}): Promise<void>;
|
|
16
|
+
supportsNetworkSwitching(): boolean;
|
|
17
|
+
name: string;
|
|
18
|
+
overrideKey: string;
|
|
19
|
+
isEmbeddedWallet: boolean;
|
|
20
|
+
private environmentId?;
|
|
21
|
+
private getAuthToken?;
|
|
22
|
+
private dynamicWaasClient;
|
|
23
|
+
activeAccountAddress: string | undefined;
|
|
24
|
+
private baseApiUrl?;
|
|
25
|
+
private relayUrl?;
|
|
26
|
+
setGetAuthTokenFunction(getAuthToken: () => string): void;
|
|
27
|
+
setEnvironmentId(environmentId: string): void;
|
|
28
|
+
setBaseApiUrl(baseApiUrl: string): void;
|
|
29
|
+
setRelayUrl(relayUrl: string): void;
|
|
30
|
+
private setActiveAccountAddress;
|
|
31
|
+
createDynamicWaasClient(): DynamicSuiWalletClient;
|
|
32
|
+
getWaasWalletClient(): DynamicSuiWalletClient;
|
|
33
|
+
validateActiveWallet(expectedAddress: string): Promise<void>;
|
|
34
|
+
createWalletAccount({ thresholdSignatureScheme, }?: {
|
|
35
|
+
thresholdSignatureScheme?: string;
|
|
36
|
+
}): Promise<{
|
|
37
|
+
accountAddress: string;
|
|
38
|
+
publicKeyHex: string;
|
|
39
|
+
rawPublicKey: any;
|
|
40
|
+
clientKeyShares: any[];
|
|
41
|
+
}>;
|
|
42
|
+
signMessage(message: string): Promise<string>;
|
|
43
|
+
private createAndSignTransaction;
|
|
44
|
+
signTransaction(transaction: Transaction): Promise<SignedTransaction>;
|
|
45
|
+
signAndExecuteTransaction(transaction: Transaction): Promise<SuiTransactionBlockResponse>;
|
|
46
|
+
getSuiClient(): Promise<SuiClient>;
|
|
47
|
+
getWalletClientByAddress({ accountAddress, }: {
|
|
48
|
+
accountAddress: string;
|
|
49
|
+
}): DynamicSuiWalletClient;
|
|
50
|
+
getWalletClient(): DynamicSuiWalletClient | undefined;
|
|
51
|
+
exportPrivateKey(): Promise<void>;
|
|
52
|
+
importPrivateKey(): Promise<void>;
|
|
53
|
+
exportClientKeyshares({ accountAddress, }: {
|
|
54
|
+
accountAddress: string;
|
|
55
|
+
}): Promise<void>;
|
|
56
|
+
}
|