@dynamic-labs/waas-ton 4.51.2 → 4.52.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 +9 -0
- package/package.cjs +1 -1
- package/package.js +1 -1
- package/package.json +12 -5
- package/src/DynamicWaasTonConnectors.cjs +12 -0
- package/src/DynamicWaasTonConnectors.d.ts +2 -0
- package/src/DynamicWaasTonConnectors.js +8 -0
- package/src/connector/DynamicWaasTonConnector.cjs +282 -0
- package/src/connector/DynamicWaasTonConnector.d.ts +153 -0
- package/src/connector/DynamicWaasTonConnector.js +278 -0
- package/src/connector/TonWalletConnector.cjs +41 -0
- package/src/connector/TonWalletConnector.d.ts +29 -0
- package/src/connector/TonWalletConnector.js +37 -0
- package/src/index.cjs +21 -15
- package/src/index.d.ts +6 -6
- package/src/index.js +12 -3
- package/src/signer/DynamicWaasTonSigner.cjs +61 -0
- package/src/signer/DynamicWaasTonSigner.d.ts +20 -0
- package/src/signer/DynamicWaasTonSigner.js +57 -0
- package/src/types/index.cjs +13 -0
- package/src/types/index.d.ts +35 -1
- package/src/types/index.js +11 -0
- package/src/utils/convertSendTransactionRequest/convertSendTransactionRequest.cjs +117 -0
- package/src/utils/convertSendTransactionRequest/convertSendTransactionRequest.d.ts +9 -0
- package/src/utils/convertSendTransactionRequest/convertSendTransactionRequest.js +113 -0
- package/src/utils/convertSendTransactionRequest/index.d.ts +1 -0
- package/src/utils/executeTransaction/executeTransaction.cjs +55 -0
- package/src/utils/executeTransaction/executeTransaction.d.ts +25 -0
- package/src/utils/executeTransaction/executeTransaction.js +51 -0
- package/src/utils/extractDisplayInfoFromRequest/extractDisplayInfoFromRequest.cjs +51 -0
- package/src/utils/extractDisplayInfoFromRequest/extractDisplayInfoFromRequest.d.ts +18 -0
- package/src/utils/extractDisplayInfoFromRequest/extractDisplayInfoFromRequest.js +47 -0
- package/src/utils/extractDisplayInfoFromRequest/index.d.ts +1 -0
- package/src/utils/generateTonConnectProofHash/generateTonConnectProofHash.cjs +89 -0
- package/src/utils/generateTonConnectProofHash/generateTonConnectProofHash.d.ts +24 -0
- package/src/utils/generateTonConnectProofHash/generateTonConnectProofHash.js +85 -0
- package/src/utils/getJettonWalletAddress/getJettonWalletAddress.cjs +32 -0
- package/src/utils/getJettonWalletAddress/getJettonWalletAddress.d.ts +17 -0
- package/src/utils/getJettonWalletAddress/getJettonWalletAddress.js +28 -0
- package/src/utils/index.d.ts +8 -0
- package/src/utils/logger/logger.cjs +4 -3
- package/src/utils/logger/logger.js +3 -1
- package/src/utils/prepareJettonTransfer/prepareJettonTransfer.cjs +78 -0
- package/src/utils/prepareJettonTransfer/prepareJettonTransfer.d.ts +31 -0
- package/src/utils/prepareJettonTransfer/prepareJettonTransfer.js +74 -0
- package/src/utils/prepareTonTransfer/prepareTonTransfer.cjs +45 -0
- package/src/utils/prepareTonTransfer/prepareTonTransfer.d.ts +23 -0
- package/src/utils/prepareTonTransfer/prepareTonTransfer.js +41 -0
- package/src/utils/prepareTransaction/prepareTransaction.cjs +65 -0
- package/src/utils/prepareTransaction/prepareTransaction.d.ts +32 -0
- package/src/utils/prepareTransaction/prepareTransaction.js +61 -0
- package/src/wallet/WaasTonWallet.cjs +31 -0
- package/src/wallet/WaasTonWallet.d.ts +10 -0
- package/src/wallet/WaasTonWallet.js +27 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,4 +1,13 @@
|
|
|
1
1
|
|
|
2
|
+
## [4.52.0](https://github.com/dynamic-labs/dynamic-auth/compare/v4.51.2...v4.52.0) (2025-12-22)
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
### Features
|
|
6
|
+
|
|
7
|
+
* add dynamic waas ton connector ([#9981](https://github.com/dynamic-labs/dynamic-auth/issues/9981)) ([95f2ecf](https://github.com/dynamic-labs/dynamic-auth/commit/95f2ecf253550ec8badad588a904599321a5846d))
|
|
8
|
+
* add getTransactionHistory to react-native ([#10132](https://github.com/dynamic-labs/dynamic-auth/issues/10132)) ([bed6ce1](https://github.com/dynamic-labs/dynamic-auth/commit/bed6ce13b5e12f80121eebf6421355ae2b87968d))
|
|
9
|
+
* add useGetTransactionHistory hook ([#10131](https://github.com/dynamic-labs/dynamic-auth/issues/10131)) ([431e7e1](https://github.com/dynamic-labs/dynamic-auth/commit/431e7e1a70cd0556c14f55c2827bb419f38a59c9))
|
|
10
|
+
|
|
2
11
|
### [4.51.2](https://github.com/dynamic-labs/dynamic-auth/compare/v4.51.1...v4.51.2) (2025-12-19)
|
|
3
12
|
|
|
4
13
|
|
package/package.cjs
CHANGED
package/package.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dynamic-labs/waas-ton",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.52.0",
|
|
4
4
|
"description": "A React SDK for implementing wallet web3 authentication and authorization to your website.",
|
|
5
5
|
"author": "Dynamic Labs, Inc.",
|
|
6
6
|
"license": "MIT",
|
|
@@ -18,11 +18,18 @@
|
|
|
18
18
|
},
|
|
19
19
|
"homepage": "https://www.dynamic.xyz/",
|
|
20
20
|
"dependencies": {
|
|
21
|
-
"@dynamic-labs/assert-package-version": "4.
|
|
22
|
-
"@dynamic-labs/logger": "4.
|
|
21
|
+
"@dynamic-labs/assert-package-version": "4.52.0",
|
|
22
|
+
"@dynamic-labs/logger": "4.52.0",
|
|
23
23
|
"@dynamic-labs/sdk-api-core": "0.0.843",
|
|
24
|
+
"@dynamic-labs/ton": "4.52.0",
|
|
24
25
|
"@ton/core": "0.62.0",
|
|
25
26
|
"@ton/crypto": "3.3.0",
|
|
26
|
-
"@ton/ton": "16.0.0"
|
|
27
|
-
|
|
27
|
+
"@ton/ton": "16.0.0",
|
|
28
|
+
"@dynamic-labs/types": "4.52.0",
|
|
29
|
+
"@dynamic-labs/utils": "4.52.0",
|
|
30
|
+
"@dynamic-labs/waas": "4.52.0",
|
|
31
|
+
"@dynamic-labs/wallet-book": "4.52.0",
|
|
32
|
+
"@dynamic-labs/wallet-connector-core": "4.52.0"
|
|
33
|
+
},
|
|
34
|
+
"peerDependencies": {}
|
|
28
35
|
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
5
|
+
|
|
6
|
+
var DynamicWaasTonConnector = require('./connector/DynamicWaasTonConnector.cjs');
|
|
7
|
+
|
|
8
|
+
const DynamicWaasTonConnectors = () => [
|
|
9
|
+
DynamicWaasTonConnector.DynamicWaasTonConnector,
|
|
10
|
+
];
|
|
11
|
+
|
|
12
|
+
exports.DynamicWaasTonConnectors = DynamicWaasTonConnectors;
|
|
@@ -0,0 +1,282 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
5
|
+
|
|
6
|
+
var _tslib = require('../../_virtual/_tslib.cjs');
|
|
7
|
+
var ton = require('@ton/ton');
|
|
8
|
+
var sdkApiCore = require('@dynamic-labs/sdk-api-core');
|
|
9
|
+
var ton$1 = require('@dynamic-labs/ton');
|
|
10
|
+
var utils = require('@dynamic-labs/utils');
|
|
11
|
+
var waas = require('@dynamic-labs/waas');
|
|
12
|
+
var walletConnectorCore = require('@dynamic-labs/wallet-connector-core');
|
|
13
|
+
var DynamicWaasTonSigner = require('../signer/DynamicWaasTonSigner.cjs');
|
|
14
|
+
var index = require('../types/index.cjs');
|
|
15
|
+
var prepareTransaction = require('../utils/prepareTransaction/prepareTransaction.cjs');
|
|
16
|
+
require('@ton/crypto');
|
|
17
|
+
var prepareTonTransfer = require('../utils/prepareTonTransfer/prepareTonTransfer.cjs');
|
|
18
|
+
var prepareJettonTransfer = require('../utils/prepareJettonTransfer/prepareJettonTransfer.cjs');
|
|
19
|
+
var getWalletSeqno = require('../utils/getWalletSeqno/getWalletSeqno.cjs');
|
|
20
|
+
var executeTransaction = require('../utils/executeTransaction/executeTransaction.cjs');
|
|
21
|
+
var extractDisplayInfoFromRequest = require('../utils/extractDisplayInfoFromRequest/extractDisplayInfoFromRequest.cjs');
|
|
22
|
+
var convertSendTransactionRequest = require('../utils/convertSendTransactionRequest/convertSendTransactionRequest.cjs');
|
|
23
|
+
var logger = require('../utils/logger/logger.cjs');
|
|
24
|
+
var TonWalletConnector = require('./TonWalletConnector.cjs');
|
|
25
|
+
var logger$1 = require('@dynamic-labs/logger');
|
|
26
|
+
|
|
27
|
+
class DynamicWaasTonConnector extends waas.withDynamicWaas(TonWalletConnector.TonWalletConnector) {
|
|
28
|
+
constructor(props) {
|
|
29
|
+
super(props);
|
|
30
|
+
this.name = 'Dynamic Waas';
|
|
31
|
+
this.overrideKey = 'dynamicwaas';
|
|
32
|
+
this.isEmbeddedWallet = true;
|
|
33
|
+
this.logger = logger.logger;
|
|
34
|
+
this.walletUiUtils = props.walletUiUtils;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Override setEnvironmentId to ensure it's set on the global logger
|
|
38
|
+
*/
|
|
39
|
+
setEnvironmentId(environmentId) {
|
|
40
|
+
super.setEnvironmentId(environmentId);
|
|
41
|
+
logger$1.Logger.setEnvironmentId(environmentId);
|
|
42
|
+
}
|
|
43
|
+
getSigner() {
|
|
44
|
+
return _tslib.__awaiter(this, void 0, void 0, function* () {
|
|
45
|
+
return new DynamicWaasTonSigner.DynamicWaasTonSigner({
|
|
46
|
+
walletConnector: this,
|
|
47
|
+
});
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
getWalletClientByAddress(_a) {
|
|
51
|
+
return _tslib.__awaiter(this, arguments, void 0, function* ({ accountAddress, }) {
|
|
52
|
+
this.setActiveAccountAddress(accountAddress);
|
|
53
|
+
return this.getWaasWalletClient();
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
getTonClient(chainId) {
|
|
57
|
+
var _a, _b, _c;
|
|
58
|
+
const targetChainId = chainId || index.CHAIN.MAINNET;
|
|
59
|
+
const network = (_a = this.tonNetworks) === null || _a === void 0 ? void 0 : _a.find((net) => net.chainId === targetChainId);
|
|
60
|
+
if (!network) {
|
|
61
|
+
throw new utils.DynamicError(`Network configuration not found for chainId: ${targetChainId}`);
|
|
62
|
+
}
|
|
63
|
+
const endpoint = ((_b = network.privateCustomerRpcUrls) === null || _b === void 0 ? void 0 : _b[0]) || ((_c = network.rpcUrls) === null || _c === void 0 ? void 0 : _c[0]);
|
|
64
|
+
if (!endpoint) {
|
|
65
|
+
throw new utils.DynamicError(`No RPC endpoint found for chainId: ${targetChainId}`);
|
|
66
|
+
}
|
|
67
|
+
return new ton.TonClient({
|
|
68
|
+
endpoint,
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
getActiveAccountAddress() {
|
|
72
|
+
return _tslib.__awaiter(this, void 0, void 0, function* () {
|
|
73
|
+
return this.activeAccountAddress;
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
setActiveAccountAddress(accountAddress) {
|
|
77
|
+
this.activeAccountAddress = accountAddress;
|
|
78
|
+
}
|
|
79
|
+
requireSignedSessionId() {
|
|
80
|
+
return _tslib.__awaiter(this, void 0, void 0, function* () {
|
|
81
|
+
var _a;
|
|
82
|
+
const signedSessionId = yield ((_a = this.getSignedSessionId) === null || _a === void 0 ? void 0 : _a.call(this));
|
|
83
|
+
if (!signedSessionId) {
|
|
84
|
+
throw new utils.DynamicError('Signed session ID is required');
|
|
85
|
+
}
|
|
86
|
+
return signedSessionId;
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
validateActiveWallet(expectedAddress) {
|
|
90
|
+
return _tslib.__awaiter(this, void 0, void 0, function* () {
|
|
91
|
+
var _a;
|
|
92
|
+
const walletClient = yield this.getWaasWalletClient();
|
|
93
|
+
const signedSessionId = yield this.requireSignedSessionId();
|
|
94
|
+
const targetWallet = yield walletClient.getWallet({
|
|
95
|
+
accountAddress: expectedAddress,
|
|
96
|
+
authToken: (_a = this.getAuthToken) === null || _a === void 0 ? void 0 : _a.call(this),
|
|
97
|
+
signedSessionId,
|
|
98
|
+
});
|
|
99
|
+
if (!targetWallet) {
|
|
100
|
+
throw new utils.DynamicError('Account not found');
|
|
101
|
+
}
|
|
102
|
+
const isWalletActive = walletConnectorCore.isSameAddress(targetWallet.accountAddress, this.activeAccountAddress || '', this.connectedChain);
|
|
103
|
+
if (!isWalletActive) {
|
|
104
|
+
this.activeAccountAddress = targetWallet.accountAddress;
|
|
105
|
+
}
|
|
106
|
+
});
|
|
107
|
+
}
|
|
108
|
+
getAddress() {
|
|
109
|
+
return _tslib.__awaiter(this, void 0, void 0, function* () {
|
|
110
|
+
return this.activeAccountAddress;
|
|
111
|
+
});
|
|
112
|
+
}
|
|
113
|
+
connect() {
|
|
114
|
+
return _tslib.__awaiter(this, void 0, void 0, function* () {
|
|
115
|
+
yield this.getWaasWalletClient();
|
|
116
|
+
});
|
|
117
|
+
}
|
|
118
|
+
signMessage(message) {
|
|
119
|
+
return _tslib.__awaiter(this, void 0, void 0, function* () {
|
|
120
|
+
return this.walletUiUtils.signMessage({
|
|
121
|
+
handler: () => _tslib.__awaiter(this, void 0, void 0, function* () { return this.internalSignMessage(message); }),
|
|
122
|
+
message,
|
|
123
|
+
walletConnector: this,
|
|
124
|
+
});
|
|
125
|
+
});
|
|
126
|
+
}
|
|
127
|
+
internalSignMessage(message) {
|
|
128
|
+
return _tslib.__awaiter(this, void 0, void 0, function* () {
|
|
129
|
+
var _a, _b;
|
|
130
|
+
const walletClient = yield this.getWaasWalletClient();
|
|
131
|
+
if (!this.activeAccountAddress) {
|
|
132
|
+
throw new Error('Active account address is required');
|
|
133
|
+
}
|
|
134
|
+
const signedSessionId = yield this.requireSignedSessionId();
|
|
135
|
+
const mfaToken = yield ((_a = this.getMfaToken) === null || _a === void 0 ? void 0 : _a.call(this, {
|
|
136
|
+
mfaAction: sdkApiCore.MFAAction.WalletWaasSign,
|
|
137
|
+
}));
|
|
138
|
+
const signedMessage = yield walletClient.signMessage({
|
|
139
|
+
accountAddress: this.activeAccountAddress,
|
|
140
|
+
authToken: (_b = this.getAuthToken) === null || _b === void 0 ? void 0 : _b.call(this),
|
|
141
|
+
message,
|
|
142
|
+
mfaToken,
|
|
143
|
+
signedSessionId,
|
|
144
|
+
});
|
|
145
|
+
return signedMessage;
|
|
146
|
+
});
|
|
147
|
+
}
|
|
148
|
+
endSession() {
|
|
149
|
+
const _super = Object.create(null, {
|
|
150
|
+
endSession: { get: () => super.endSession }
|
|
151
|
+
});
|
|
152
|
+
return _tslib.__awaiter(this, void 0, void 0, function* () {
|
|
153
|
+
yield _super.endSession.call(this);
|
|
154
|
+
this.activeAccountAddress = undefined;
|
|
155
|
+
});
|
|
156
|
+
}
|
|
157
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
158
|
+
signMessageWithContext(_params) {
|
|
159
|
+
return _tslib.__awaiter(this, void 0, void 0, function* () {
|
|
160
|
+
throw new Error('Method not implemented.');
|
|
161
|
+
});
|
|
162
|
+
}
|
|
163
|
+
sendTransaction(request) {
|
|
164
|
+
return _tslib.__awaiter(this, void 0, void 0, function* () {
|
|
165
|
+
if (!this.activeAccountAddress) {
|
|
166
|
+
throw new utils.DynamicError('Active account address is required');
|
|
167
|
+
}
|
|
168
|
+
// TON Connect spec allows 1-4 messages per transaction
|
|
169
|
+
if (request.messages.length < 1 || request.messages.length > 4) {
|
|
170
|
+
throw new utils.DynamicError(`Invalid message count: ${request.messages.length}. Must be between 1 and 4.`);
|
|
171
|
+
}
|
|
172
|
+
const displayInfo = extractDisplayInfoFromRequest.extractDisplayInfoFromRequest(request);
|
|
173
|
+
const uiTransaction = new ton$1.TonUiTransaction({
|
|
174
|
+
client: this.getTonClient(),
|
|
175
|
+
from: this.activeAccountAddress,
|
|
176
|
+
onSubmit: () => _tslib.__awaiter(this, void 0, void 0, function* () { return this.internalSendTransaction(request); }),
|
|
177
|
+
});
|
|
178
|
+
uiTransaction.to = displayInfo.recipient;
|
|
179
|
+
uiTransaction.value = displayInfo.value
|
|
180
|
+
? BigInt(displayInfo.value)
|
|
181
|
+
: undefined;
|
|
182
|
+
// Handle jetton transfers
|
|
183
|
+
if (displayInfo.jettonAddress && displayInfo.jettonAmount) {
|
|
184
|
+
uiTransaction.nonNativeAddress = displayInfo.jettonAddress;
|
|
185
|
+
uiTransaction.nonNativeValue = BigInt(displayInfo.jettonAmount);
|
|
186
|
+
}
|
|
187
|
+
return this.walletUiUtils.sendTransaction(this, uiTransaction);
|
|
188
|
+
});
|
|
189
|
+
}
|
|
190
|
+
internalSendTransaction(request) {
|
|
191
|
+
return _tslib.__awaiter(this, void 0, void 0, function* () {
|
|
192
|
+
var _a, _b;
|
|
193
|
+
if (!this.activeAccountAddress) {
|
|
194
|
+
throw new utils.DynamicError('Active account address is required');
|
|
195
|
+
}
|
|
196
|
+
const client = this.getTonClient();
|
|
197
|
+
const walletAddress = request.from || this.activeAccountAddress;
|
|
198
|
+
const network = request.network || index.CHAIN.MAINNET;
|
|
199
|
+
const seqno = yield getWalletSeqno.getWalletSeqno(walletAddress, client);
|
|
200
|
+
const actionsArray = convertSendTransactionRequest.convertSendTransactionRequest(request);
|
|
201
|
+
const { hashToSignHex, transactionData } = prepareTransaction.prepareTransaction({
|
|
202
|
+
actionsArray,
|
|
203
|
+
networkGlobalId: network,
|
|
204
|
+
seqno,
|
|
205
|
+
timeout: request.validUntil - Math.floor(Date.now() / 1000),
|
|
206
|
+
validUntil: request.validUntil,
|
|
207
|
+
walletAddress,
|
|
208
|
+
});
|
|
209
|
+
const walletClient = yield this.getWaasWalletClient();
|
|
210
|
+
const signedSessionId = yield this.requireSignedSessionId();
|
|
211
|
+
const mfaToken = yield ((_a = this.getMfaToken) === null || _a === void 0 ? void 0 : _a.call(this, {
|
|
212
|
+
mfaAction: sdkApiCore.MFAAction.WalletWaasSign,
|
|
213
|
+
}));
|
|
214
|
+
const signature = yield walletClient.signTransaction({
|
|
215
|
+
authToken: (_b = this.getAuthToken) === null || _b === void 0 ? void 0 : _b.call(this),
|
|
216
|
+
mfaToken,
|
|
217
|
+
senderAddress: this.activeAccountAddress,
|
|
218
|
+
signedSessionId,
|
|
219
|
+
transaction: hashToSignHex,
|
|
220
|
+
});
|
|
221
|
+
const result = yield executeTransaction.executeTransaction({
|
|
222
|
+
client,
|
|
223
|
+
signature,
|
|
224
|
+
transactionData,
|
|
225
|
+
});
|
|
226
|
+
if (!result.success) {
|
|
227
|
+
throw new utils.DynamicError(`Failed to execute transaction: ${result.error || 'Unknown error'}`);
|
|
228
|
+
}
|
|
229
|
+
return result.transactionHash || '';
|
|
230
|
+
});
|
|
231
|
+
}
|
|
232
|
+
internalSendUiTransaction(transaction) {
|
|
233
|
+
return _tslib.__awaiter(this, void 0, void 0, function* () {
|
|
234
|
+
if (!transaction.to) {
|
|
235
|
+
throw new utils.DynamicError('Destination address is required');
|
|
236
|
+
}
|
|
237
|
+
if (!this.activeAccountAddress) {
|
|
238
|
+
throw new utils.DynamicError('Active account address is required');
|
|
239
|
+
}
|
|
240
|
+
const client = this.getTonClient();
|
|
241
|
+
// Handle Jetton (non-native token) transfers
|
|
242
|
+
if (transaction.nonNativeAddress && transaction.nonNativeValue) {
|
|
243
|
+
const request = yield prepareJettonTransfer.prepareJettonTransfer({
|
|
244
|
+
client,
|
|
245
|
+
forwardTonAmount: BigInt(0),
|
|
246
|
+
jettonAmount: transaction.nonNativeValue,
|
|
247
|
+
jettonMasterAddress: transaction.nonNativeAddress,
|
|
248
|
+
recipientAddress: transaction.to,
|
|
249
|
+
timeout: 60,
|
|
250
|
+
walletAddress: this.activeAccountAddress,
|
|
251
|
+
});
|
|
252
|
+
return this.internalSendTransaction(request);
|
|
253
|
+
}
|
|
254
|
+
// Handle native TON transfers
|
|
255
|
+
if (transaction.value) {
|
|
256
|
+
const tonAmount = Number(transaction.value) / ton$1.NANOTON_PER_TON;
|
|
257
|
+
const request = yield prepareTonTransfer.prepareTonTransfer({
|
|
258
|
+
amount: tonAmount,
|
|
259
|
+
client,
|
|
260
|
+
recipient: transaction.to,
|
|
261
|
+
timeout: 60,
|
|
262
|
+
walletAddress: this.activeAccountAddress,
|
|
263
|
+
});
|
|
264
|
+
return this.internalSendTransaction(request);
|
|
265
|
+
}
|
|
266
|
+
throw new utils.DynamicError('Invalid transaction parameters');
|
|
267
|
+
});
|
|
268
|
+
}
|
|
269
|
+
createUiTransaction(from) {
|
|
270
|
+
return _tslib.__awaiter(this, void 0, void 0, function* () {
|
|
271
|
+
yield this.validateActiveWallet(from);
|
|
272
|
+
const client = this.getTonClient();
|
|
273
|
+
return new ton$1.TonUiTransaction({
|
|
274
|
+
client,
|
|
275
|
+
from,
|
|
276
|
+
onSubmit: (transaction) => _tslib.__awaiter(this, void 0, void 0, function* () { return this.internalSendUiTransaction(transaction); }),
|
|
277
|
+
});
|
|
278
|
+
});
|
|
279
|
+
}
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
exports.DynamicWaasTonConnector = DynamicWaasTonConnector;
|
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
import { TonClient } from '@ton/ton';
|
|
2
|
+
import { MFAAction, SignMessageContext } from '@dynamic-labs/sdk-api-core';
|
|
3
|
+
import { IUITransaction, WalletUiUtils } from '@dynamic-labs/types';
|
|
4
|
+
import { IDynamicWaasConnector, InternalWalletConnector } from '@dynamic-labs/wallet-connector-core';
|
|
5
|
+
import { DynamicWaasTonSigner } from '../signer/DynamicWaasTonSigner';
|
|
6
|
+
import { SendTransactionRequest } from '../types';
|
|
7
|
+
import { Logger } from '../utils';
|
|
8
|
+
import { TonWalletConnector, TonWalletConnectorOpts } from './TonWalletConnector';
|
|
9
|
+
export type DynamicWaasTonConnectorProps = TonWalletConnectorOpts & {
|
|
10
|
+
walletUiUtils: WalletUiUtils<InternalWalletConnector>;
|
|
11
|
+
};
|
|
12
|
+
declare const DynamicWaasTonConnector_base: (abstract new (...args: any[]) => {
|
|
13
|
+
[x: string]: any;
|
|
14
|
+
name: string;
|
|
15
|
+
overrideKey: string;
|
|
16
|
+
isEmbeddedWallet: boolean;
|
|
17
|
+
getSignedSessionId?: (() => Promise<string>) | undefined;
|
|
18
|
+
getMfaToken?: ((props?: {
|
|
19
|
+
mfaAction?: MFAAction | undefined;
|
|
20
|
+
} | undefined) => Promise<string | undefined>) | undefined;
|
|
21
|
+
getAuthToken?: (() => string) | undefined;
|
|
22
|
+
environmentId?: string | undefined;
|
|
23
|
+
baseApiUrl?: string | undefined;
|
|
24
|
+
relayUrl?: string | undefined;
|
|
25
|
+
baseClientKeysharesRelayApiUrl?: string | undefined;
|
|
26
|
+
dynamicWaasClient: import("@dynamic-labs-wallet/browser-wallet-client").DynamicWalletClient | undefined;
|
|
27
|
+
chainName: string;
|
|
28
|
+
authMode: "cookie" | "header";
|
|
29
|
+
logger: Logger;
|
|
30
|
+
__exportHandler: import("@dynamic-labs/waas").WaasExportHandler;
|
|
31
|
+
validateActiveWallet(expectedAddress: string): Promise<void>;
|
|
32
|
+
setGetAuthTokenFunction(getAuthToken: () => string): void;
|
|
33
|
+
setWaasAuthMode(authMode: "cookie" | "header"): void;
|
|
34
|
+
setGetMfaTokenFunction(getMfaToken: (props?: {
|
|
35
|
+
mfaAction?: MFAAction | undefined;
|
|
36
|
+
} | undefined) => Promise<string | undefined>): void;
|
|
37
|
+
setEnvironmentId(environmentId: string): void;
|
|
38
|
+
setBaseApiUrl(baseApiUrl: string): void;
|
|
39
|
+
setBaseClientKeysharesRelayApiUrl(baseClientKeysharesRelayApiUrl?: string | undefined): void;
|
|
40
|
+
setRelayUrl(relayUrl: string): void;
|
|
41
|
+
setGetSignedSessionIdFunction(getSignedSessionId: () => Promise<string>): void;
|
|
42
|
+
delegateKeyShares({ accountAddress, password, }: {
|
|
43
|
+
accountAddress: string;
|
|
44
|
+
password?: string | undefined;
|
|
45
|
+
}): Promise<void>;
|
|
46
|
+
createDynamicWaasClient(traceContext?: import("dist/packages/waas/utils/instrumentation").TraceContext | undefined): Promise<import("@dynamic-labs-wallet/browser-wallet-client").DynamicWalletClient>;
|
|
47
|
+
getWaasWalletClient(traceContext?: import("dist/packages/waas/utils/instrumentation").TraceContext | undefined): Promise<import("@dynamic-labs-wallet/browser-wallet-client").DynamicWalletClient>;
|
|
48
|
+
createWalletAccount({ thresholdSignatureScheme, password, }?: {
|
|
49
|
+
thresholdSignatureScheme?: string | undefined;
|
|
50
|
+
password?: string | undefined;
|
|
51
|
+
} | undefined): Promise<{
|
|
52
|
+
chainName: string;
|
|
53
|
+
accountAddress: string;
|
|
54
|
+
publicKeyHex: string;
|
|
55
|
+
rawPublicKey: string | Uint8Array | undefined;
|
|
56
|
+
}>;
|
|
57
|
+
importPrivateKey({ privateKey, thresholdSignatureScheme, publicAddressCheck, }: {
|
|
58
|
+
privateKey: string;
|
|
59
|
+
thresholdSignatureScheme?: string | undefined;
|
|
60
|
+
publicAddressCheck?: string | undefined;
|
|
61
|
+
}): Promise<void>;
|
|
62
|
+
exportPrivateKey({ accountAddress, displayContainer, password, }?: {
|
|
63
|
+
accountAddress?: string | undefined;
|
|
64
|
+
displayContainer?: HTMLIFrameElement | undefined;
|
|
65
|
+
password?: string | undefined;
|
|
66
|
+
} | undefined): Promise<void>;
|
|
67
|
+
getExportHandler(): {
|
|
68
|
+
clear: () => void;
|
|
69
|
+
};
|
|
70
|
+
exportClientKeyshares({ accountAddress, password, }: {
|
|
71
|
+
accountAddress: string;
|
|
72
|
+
password?: string | undefined;
|
|
73
|
+
}): Promise<void>;
|
|
74
|
+
backupKeySharesToGoogleDrive({ accountAddress, password, }: {
|
|
75
|
+
accountAddress: string;
|
|
76
|
+
password?: string | undefined;
|
|
77
|
+
}): Promise<void>;
|
|
78
|
+
exportClientKeysharesFromGoogleDrive({ accountAddress, password, }: {
|
|
79
|
+
accountAddress: string;
|
|
80
|
+
password?: string | undefined;
|
|
81
|
+
}): Promise<void>;
|
|
82
|
+
refreshWalletAccountShares({ accountAddress, password, }: {
|
|
83
|
+
accountAddress: string;
|
|
84
|
+
password?: string | undefined;
|
|
85
|
+
}): Promise<void>;
|
|
86
|
+
reshareWalletAccountShares({ accountAddress, thresholdSignatureScheme, password, }: {
|
|
87
|
+
accountAddress: string;
|
|
88
|
+
thresholdSignatureScheme: string;
|
|
89
|
+
password?: string | undefined;
|
|
90
|
+
}): Promise<void>;
|
|
91
|
+
revokeDelegation({ accountAddress, password, }: {
|
|
92
|
+
accountAddress: string;
|
|
93
|
+
password?: string | undefined;
|
|
94
|
+
}): Promise<void>;
|
|
95
|
+
updatePassword({ accountAddress, existingPassword, newPassword, }: {
|
|
96
|
+
accountAddress: string;
|
|
97
|
+
existingPassword: string;
|
|
98
|
+
newPassword: string;
|
|
99
|
+
}): Promise<void>;
|
|
100
|
+
signRawMessage({ accountAddress, message, password, }: {
|
|
101
|
+
accountAddress: string;
|
|
102
|
+
message: string;
|
|
103
|
+
password?: string | undefined;
|
|
104
|
+
}): Promise<string>;
|
|
105
|
+
endSession(): Promise<void>;
|
|
106
|
+
getActiveAccountAddress(): Promise<string | undefined>;
|
|
107
|
+
generateTraceId(): string;
|
|
108
|
+
instrument(message: string, context: import("dist/packages/logger/src").InstrumentOptions & import("dist/packages/waas/utils/instrumentation").InstrumentContext & Record<string, any>): void;
|
|
109
|
+
instrumentAsync<T_1>({ operation, resource, fn, context, }: {
|
|
110
|
+
operation: string;
|
|
111
|
+
resource: string;
|
|
112
|
+
fn: (timing: import("dist/packages/waas/utils/instrumentation").InstrumentationTimer) => Promise<T_1>;
|
|
113
|
+
context?: Record<string, any> | undefined;
|
|
114
|
+
}): Promise<T_1>;
|
|
115
|
+
}) & typeof TonWalletConnector;
|
|
116
|
+
export declare class DynamicWaasTonConnector extends DynamicWaasTonConnector_base implements IDynamicWaasConnector {
|
|
117
|
+
name: string;
|
|
118
|
+
overrideKey: string;
|
|
119
|
+
isEmbeddedWallet: boolean;
|
|
120
|
+
logger: Logger;
|
|
121
|
+
activeAccountAddress: string | undefined;
|
|
122
|
+
protected walletUiUtils: WalletUiUtils<InternalWalletConnector>;
|
|
123
|
+
constructor(props: DynamicWaasTonConnectorProps);
|
|
124
|
+
/**
|
|
125
|
+
* Override setEnvironmentId to ensure it's set on the global logger
|
|
126
|
+
*/
|
|
127
|
+
setEnvironmentId(environmentId: string): void;
|
|
128
|
+
getSigner(): Promise<DynamicWaasTonSigner>;
|
|
129
|
+
getWalletClientByAddress({ accountAddress, }: {
|
|
130
|
+
accountAddress: string;
|
|
131
|
+
}): Promise<import("@dynamic-labs-wallet/browser-wallet-client").DynamicWalletClient>;
|
|
132
|
+
getTonClient(chainId?: string): TonClient;
|
|
133
|
+
getActiveAccountAddress(): Promise<string | undefined>;
|
|
134
|
+
private setActiveAccountAddress;
|
|
135
|
+
private requireSignedSessionId;
|
|
136
|
+
validateActiveWallet(expectedAddress: string): Promise<void>;
|
|
137
|
+
getAddress(): Promise<string | undefined>;
|
|
138
|
+
connect(): Promise<void>;
|
|
139
|
+
signMessage(message: string): Promise<string>;
|
|
140
|
+
internalSignMessage(message: string): Promise<string>;
|
|
141
|
+
endSession(): Promise<void>;
|
|
142
|
+
signMessageWithContext(_params: {
|
|
143
|
+
message: string | {
|
|
144
|
+
raw: string;
|
|
145
|
+
};
|
|
146
|
+
context: SignMessageContext;
|
|
147
|
+
}): Promise<string>;
|
|
148
|
+
sendTransaction(request: SendTransactionRequest): Promise<string>;
|
|
149
|
+
private internalSendTransaction;
|
|
150
|
+
private internalSendUiTransaction;
|
|
151
|
+
createUiTransaction(from: string): Promise<IUITransaction>;
|
|
152
|
+
}
|
|
153
|
+
export {};
|