@msafe/sui3-sdk 0.0.52 → 0.0.53-pre-ee66e4c.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/dist/index.cjs +2760 -2693
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +2785 -2718
- package/dist/index.js.map +1 -1
- package/package.json +4 -7
- package/src/core/MSafeAccount.ts +15 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@msafe/sui3-sdk",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.53-pre-ee66e4c.0",
|
|
4
4
|
"description": "SDK for MSafe SUI V3",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"module": "./dist/index.js",
|
|
@@ -21,14 +21,14 @@
|
|
|
21
21
|
"author": "MSafe <admin@m-safe.io>",
|
|
22
22
|
"license": "MIT",
|
|
23
23
|
"dependencies": {
|
|
24
|
-
"@msafe/sui-wallet": "^0.0.
|
|
25
|
-
"@msafe/sui3-utils": "^3.1.
|
|
24
|
+
"@msafe/sui-wallet": "^0.0.68-pre-33f4442.0",
|
|
25
|
+
"@msafe/sui3-utils": "^3.1.65",
|
|
26
|
+
"@mysten/sui.js": "0.53.0",
|
|
26
27
|
"axios": "^1.6.6",
|
|
27
28
|
"buffer": "^6.0.3"
|
|
28
29
|
},
|
|
29
30
|
"devDependencies": {
|
|
30
31
|
"@msafe/mpay-sdk-sui": "^1.0.25",
|
|
31
|
-
"@mysten/sui.js": "^0.50.1",
|
|
32
32
|
"@types/jest": "^29.5.8",
|
|
33
33
|
"@types/node": "^20.9.2",
|
|
34
34
|
"@typescript-eslint/eslint-plugin": "^6.5.0",
|
|
@@ -62,8 +62,5 @@
|
|
|
62
62
|
"build": "yarn clean && tsup --platform browser --format cjs,esm --dts",
|
|
63
63
|
"build-yalc": "yarn build && yalc publish --private",
|
|
64
64
|
"prerelease": "yarn build && chmod +x ./scripts/prerelease.sh && ./scripts/prerelease.sh"
|
|
65
|
-
},
|
|
66
|
-
"peerDependencies": {
|
|
67
|
-
"@mysten/sui.js": ">0.46.0"
|
|
68
65
|
}
|
|
69
66
|
}
|
package/src/core/MSafeAccount.ts
CHANGED
|
@@ -19,7 +19,8 @@ import {
|
|
|
19
19
|
import { SuiObjectData, SuiObjectResponse } from '@mysten/sui.js/client';
|
|
20
20
|
import { SerializedSignature } from '@mysten/sui.js/cryptography';
|
|
21
21
|
import { TransactionBlock } from '@mysten/sui.js/transactions';
|
|
22
|
-
import { normalizeStructTag, toHEX } from '@mysten/sui.js/utils';
|
|
22
|
+
import { fromHEX, normalizeStructTag, toHEX } from '@mysten/sui.js/utils';
|
|
23
|
+
import { SUI_MAINNET_CHAIN, SUI_TESTNET_CHAIN } from '@mysten/wallet-standard';
|
|
23
24
|
|
|
24
25
|
import { MSafeGlobals } from '@/globals/MSafeGlobals';
|
|
25
26
|
import { Simulator } from '@/simulate/simulator';
|
|
@@ -144,6 +145,9 @@ export class MSafeAccount {
|
|
|
144
145
|
suiClient: this.globals.suiClient,
|
|
145
146
|
account: {
|
|
146
147
|
address: this.address,
|
|
148
|
+
publicKey: fromHEX(this.address),
|
|
149
|
+
chains: [SUI_MAINNET_CHAIN, SUI_TESTNET_CHAIN],
|
|
150
|
+
features: [],
|
|
147
151
|
},
|
|
148
152
|
});
|
|
149
153
|
return this.simulator.simulate({ txb, sender: this.address });
|
|
@@ -182,11 +186,16 @@ export class MSafeAccount {
|
|
|
182
186
|
suiClient: this.globals.suiClient,
|
|
183
187
|
account: {
|
|
184
188
|
address: this.address,
|
|
189
|
+
publicKey: fromHEX(this.address),
|
|
190
|
+
chains: [SUI_MAINNET_CHAIN, SUI_TESTNET_CHAIN],
|
|
191
|
+
features: [],
|
|
185
192
|
},
|
|
186
193
|
});
|
|
194
|
+
const userAddress = await this.wallet.address();
|
|
195
|
+
console.log('🚀 ~ MSafeAccount ~ userAddress:', userAddress);
|
|
187
196
|
txb.setGasPrice(input.gasPrice);
|
|
188
197
|
txb.setGasBudget(input.gasBudget);
|
|
189
|
-
txb.setSender(
|
|
198
|
+
txb.setSender(userAddress);
|
|
190
199
|
const payload = await txb.build({ client: this.globals.suiClient });
|
|
191
200
|
const digest = await txb.getDigest({ client: this.globals.suiClient });
|
|
192
201
|
|
|
@@ -347,6 +356,9 @@ export class MSafeAccount {
|
|
|
347
356
|
suiClient: this.globals.suiClient,
|
|
348
357
|
account: {
|
|
349
358
|
address: this.address,
|
|
359
|
+
publicKey: fromHEX(this.address),
|
|
360
|
+
chains: [SUI_MAINNET_CHAIN, SUI_TESTNET_CHAIN],
|
|
361
|
+
features: [],
|
|
350
362
|
},
|
|
351
363
|
});
|
|
352
364
|
return this.simulator.simulate({ txb, sender: this.address });
|
|
@@ -383,6 +395,7 @@ export class MSafeAccount {
|
|
|
383
395
|
}
|
|
384
396
|
}
|
|
385
397
|
const multiSignature = this.multiSig.combinePartialSignatures(sortedSigs);
|
|
398
|
+
console.log('🚀 ~ MSafeAccount ~ executePendingTx ~ multiSignature:', sortedSigs, multiSignature);
|
|
386
399
|
return this.suiClient.executeTransactionBlock({
|
|
387
400
|
transactionBlock: HexToUint8Array(payload),
|
|
388
401
|
signature: multiSignature,
|