@onekeyfe/onekey-sui-provider 2.2.71 → 2.2.73
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.
|
@@ -19,6 +19,35 @@ const PROVIDER_EVENTS = {
|
|
|
19
19
|
'networkChange': 'networkChange',
|
|
20
20
|
'message_low_level': 'message_low_level',
|
|
21
21
|
};
|
|
22
|
+
const SUI_SUPPORTED_TRANSACTION_INTENTS = ['CoinWithBalance'];
|
|
23
|
+
function serializeSuiTransaction(transaction) {
|
|
24
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
25
|
+
if (transaction.toJSON) {
|
|
26
|
+
return transaction.toJSON({
|
|
27
|
+
supportedIntents: [...SUI_SUPPORTED_TRANSACTION_INTENTS],
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
if (transaction.serialize) {
|
|
31
|
+
return transaction.serialize();
|
|
32
|
+
}
|
|
33
|
+
throw new Error('Invalid Sui transaction');
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
function serializeSuiTransactionBlock(transaction) {
|
|
37
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
38
|
+
if (transaction.serialize) {
|
|
39
|
+
try {
|
|
40
|
+
return transaction.serialize();
|
|
41
|
+
}
|
|
42
|
+
catch (error) {
|
|
43
|
+
if (!transaction.toJSON) {
|
|
44
|
+
throw error;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
return serializeSuiTransaction(transaction);
|
|
49
|
+
});
|
|
50
|
+
}
|
|
22
51
|
function isWalletEventMethodMatch({ method, name }) {
|
|
23
52
|
return method === `wallet_events_${name}`;
|
|
24
53
|
}
|
|
@@ -140,7 +169,7 @@ class ProviderSui extends ProviderSuiBase {
|
|
|
140
169
|
account: input.account,
|
|
141
170
|
chain: input.chain,
|
|
142
171
|
walletSerialize: JSON.stringify(input.account),
|
|
143
|
-
blockSerialize: input.transactionBlock
|
|
172
|
+
blockSerialize: yield serializeSuiTransactionBlock(input.transactionBlock),
|
|
144
173
|
},
|
|
145
174
|
});
|
|
146
175
|
});
|
|
@@ -153,7 +182,7 @@ class ProviderSui extends ProviderSuiBase {
|
|
|
153
182
|
account: input.account,
|
|
154
183
|
chain: input.chain,
|
|
155
184
|
walletSerialize: JSON.stringify(input.account),
|
|
156
|
-
blockSerialize: input.transactionBlock
|
|
185
|
+
blockSerialize: yield serializeSuiTransactionBlock(input.transactionBlock),
|
|
157
186
|
},
|
|
158
187
|
});
|
|
159
188
|
});
|
|
@@ -179,7 +208,7 @@ class ProviderSui extends ProviderSuiBase {
|
|
|
179
208
|
return this._callBridge({
|
|
180
209
|
method: 'signTransaction',
|
|
181
210
|
params: {
|
|
182
|
-
transaction: yield input.transaction
|
|
211
|
+
transaction: yield serializeSuiTransaction(input.transaction),
|
|
183
212
|
account: input.account,
|
|
184
213
|
chain: input.chain,
|
|
185
214
|
},
|
|
@@ -191,7 +220,7 @@ class ProviderSui extends ProviderSuiBase {
|
|
|
191
220
|
return this._callBridge({
|
|
192
221
|
method: 'signAndExecuteTransaction',
|
|
193
222
|
params: {
|
|
194
|
-
transaction: yield input.transaction
|
|
223
|
+
transaction: yield serializeSuiTransaction(input.transaction),
|
|
195
224
|
account: input.account,
|
|
196
225
|
chain: input.chain,
|
|
197
226
|
},
|
|
@@ -22,6 +22,35 @@ const PROVIDER_EVENTS = {
|
|
|
22
22
|
'networkChange': 'networkChange',
|
|
23
23
|
'message_low_level': 'message_low_level',
|
|
24
24
|
};
|
|
25
|
+
const SUI_SUPPORTED_TRANSACTION_INTENTS = ['CoinWithBalance'];
|
|
26
|
+
function serializeSuiTransaction(transaction) {
|
|
27
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
28
|
+
if (transaction.toJSON) {
|
|
29
|
+
return transaction.toJSON({
|
|
30
|
+
supportedIntents: [...SUI_SUPPORTED_TRANSACTION_INTENTS],
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
if (transaction.serialize) {
|
|
34
|
+
return transaction.serialize();
|
|
35
|
+
}
|
|
36
|
+
throw new Error('Invalid Sui transaction');
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
function serializeSuiTransactionBlock(transaction) {
|
|
40
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
41
|
+
if (transaction.serialize) {
|
|
42
|
+
try {
|
|
43
|
+
return transaction.serialize();
|
|
44
|
+
}
|
|
45
|
+
catch (error) {
|
|
46
|
+
if (!transaction.toJSON) {
|
|
47
|
+
throw error;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
return serializeSuiTransaction(transaction);
|
|
52
|
+
});
|
|
53
|
+
}
|
|
25
54
|
function isWalletEventMethodMatch({ method, name }) {
|
|
26
55
|
return method === `wallet_events_${name}`;
|
|
27
56
|
}
|
|
@@ -143,7 +172,7 @@ class ProviderSui extends ProviderSuiBase_1.ProviderSuiBase {
|
|
|
143
172
|
account: input.account,
|
|
144
173
|
chain: input.chain,
|
|
145
174
|
walletSerialize: JSON.stringify(input.account),
|
|
146
|
-
blockSerialize: input.transactionBlock
|
|
175
|
+
blockSerialize: yield serializeSuiTransactionBlock(input.transactionBlock),
|
|
147
176
|
},
|
|
148
177
|
});
|
|
149
178
|
});
|
|
@@ -156,7 +185,7 @@ class ProviderSui extends ProviderSuiBase_1.ProviderSuiBase {
|
|
|
156
185
|
account: input.account,
|
|
157
186
|
chain: input.chain,
|
|
158
187
|
walletSerialize: JSON.stringify(input.account),
|
|
159
|
-
blockSerialize: input.transactionBlock
|
|
188
|
+
blockSerialize: yield serializeSuiTransactionBlock(input.transactionBlock),
|
|
160
189
|
},
|
|
161
190
|
});
|
|
162
191
|
});
|
|
@@ -182,7 +211,7 @@ class ProviderSui extends ProviderSuiBase_1.ProviderSuiBase {
|
|
|
182
211
|
return this._callBridge({
|
|
183
212
|
method: 'signTransaction',
|
|
184
213
|
params: {
|
|
185
|
-
transaction: yield input.transaction
|
|
214
|
+
transaction: yield serializeSuiTransaction(input.transaction),
|
|
186
215
|
account: input.account,
|
|
187
216
|
chain: input.chain,
|
|
188
217
|
},
|
|
@@ -194,7 +223,7 @@ class ProviderSui extends ProviderSuiBase_1.ProviderSuiBase {
|
|
|
194
223
|
return this._callBridge({
|
|
195
224
|
method: 'signAndExecuteTransaction',
|
|
196
225
|
params: {
|
|
197
|
-
transaction: yield input.transaction
|
|
226
|
+
transaction: yield serializeSuiTransaction(input.transaction),
|
|
198
227
|
account: input.account,
|
|
199
228
|
chain: input.chain,
|
|
200
229
|
},
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@onekeyfe/onekey-sui-provider",
|
|
3
|
-
"version": "2.2.
|
|
3
|
+
"version": "2.2.73",
|
|
4
4
|
"keywords": [
|
|
5
5
|
"cross-inpage-provider"
|
|
6
6
|
],
|
|
@@ -28,12 +28,12 @@
|
|
|
28
28
|
},
|
|
29
29
|
"dependencies": {
|
|
30
30
|
"@mysten/wallet-standard": "^0.14.0",
|
|
31
|
-
"@onekeyfe/cross-inpage-provider-core": "2.2.
|
|
32
|
-
"@onekeyfe/cross-inpage-provider-errors": "2.2.
|
|
33
|
-
"@onekeyfe/cross-inpage-provider-types": "2.2.
|
|
34
|
-
"@onekeyfe/extension-bridge-injected": "2.2.
|
|
31
|
+
"@onekeyfe/cross-inpage-provider-core": "2.2.73",
|
|
32
|
+
"@onekeyfe/cross-inpage-provider-errors": "2.2.73",
|
|
33
|
+
"@onekeyfe/cross-inpage-provider-types": "2.2.73",
|
|
34
|
+
"@onekeyfe/extension-bridge-injected": "2.2.73",
|
|
35
35
|
"eth-rpc-errors": "^4.0.3",
|
|
36
36
|
"mitt": "^3.0.0"
|
|
37
37
|
},
|
|
38
|
-
"gitHead": "
|
|
38
|
+
"gitHead": "575a9d1d75abbe6e6972c12e4fbf1ec09b48aa33"
|
|
39
39
|
}
|