@msafe/sui3-sdk 0.0.12 → 0.0.13
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 +681 -698
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +20 -13
- package/dist/index.d.ts +20 -13
- package/dist/index.js +687 -708
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
- package/src/backend/BackendImpl.ts +4 -25
- package/src/backend/interface.ts +2 -11
- package/src/core/MSafeAccount.ts +11 -16
- package/src/types/msafe.ts +12 -0
package/src/core/MSafeAccount.ts
CHANGED
|
@@ -1,16 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
buildIntentionTransaction,
|
|
3
|
-
getIntentionType,
|
|
4
|
-
MSafeAccountInfo,
|
|
5
|
-
MultisigAccountManager,
|
|
6
|
-
} from '@msafe/sui3-utils';
|
|
1
|
+
import { buildIntentionTransaction, MSafeAccountInfo, MultisigAccountManager } from '@msafe/sui3-utils';
|
|
7
2
|
import { SuiObjectData } from '@mysten/sui.js/client';
|
|
8
3
|
import { SerializedSignature } from '@mysten/sui.js/cryptography';
|
|
9
4
|
import { SuiObjectResponse } from '@mysten/sui.js/src/client';
|
|
10
5
|
import { normalizeStructTag } from '@mysten/sui.js/utils';
|
|
11
6
|
|
|
12
7
|
import { MessageHelper } from '@/core/MessageHelper';
|
|
13
|
-
import { MSAFE_APPLICATION } from '@/globals';
|
|
14
8
|
import { MSafeGlobals } from '@/globals/MSafeGlobals';
|
|
15
9
|
import { IntentionHelper, TxIntention } from '@/transactions/intention';
|
|
16
10
|
import { OwnedCoin } from '@/types/assets';
|
|
@@ -104,27 +98,28 @@ export class MSafeAccount {
|
|
|
104
98
|
return this.backend.getNextSequenceNumber(this.address);
|
|
105
99
|
}
|
|
106
100
|
|
|
107
|
-
async proposeIntention(
|
|
101
|
+
async proposeIntention(input: {
|
|
102
|
+
application: string;
|
|
103
|
+
txType: string;
|
|
104
|
+
txSubType: string;
|
|
105
|
+
intention: TxIntention;
|
|
106
|
+
sequenceNumber: number;
|
|
107
|
+
}) {
|
|
108
108
|
const message = MessageHelper.proposeIntentionMessage({
|
|
109
|
-
intention,
|
|
110
|
-
sn: sequenceNumber,
|
|
111
109
|
msafeAddress: this.address,
|
|
110
|
+
intention: input.intention,
|
|
111
|
+
sn: input.sequenceNumber,
|
|
112
112
|
});
|
|
113
113
|
const signature = await this.wallet.signPersonalMessage({
|
|
114
114
|
messageStr: message,
|
|
115
115
|
});
|
|
116
116
|
|
|
117
|
-
const txType = getIntentionType(intention);
|
|
118
117
|
// TODO get application from common utils
|
|
119
118
|
await this.backend.proposeIntention({
|
|
120
|
-
|
|
121
|
-
sequenceNumber,
|
|
119
|
+
...input,
|
|
122
120
|
msafeAddress: this.address,
|
|
123
121
|
userAddress: await this.userAddress(),
|
|
124
122
|
signature: signature.signature,
|
|
125
|
-
application: MSAFE_APPLICATION,
|
|
126
|
-
txType: txType.txType,
|
|
127
|
-
txSubType: txType.txSubType,
|
|
128
123
|
});
|
|
129
124
|
}
|
|
130
125
|
|
package/src/types/msafe.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { GasCostSummary, DryRunTransactionBlockResponse } from '@mysten/sui.js/client';
|
|
2
2
|
|
|
3
3
|
import { TxIntention } from '@/transactions/intention';
|
|
4
|
+
import { SerializedSignature } from '@mysten/sui.js/cryptography';
|
|
4
5
|
|
|
5
6
|
export interface PendingTx {
|
|
6
7
|
digest: string;
|
|
@@ -65,6 +66,17 @@ export interface FutureIntention {
|
|
|
65
66
|
createdAt: Date;
|
|
66
67
|
}
|
|
67
68
|
|
|
69
|
+
export interface ProposeIntention {
|
|
70
|
+
application: string;
|
|
71
|
+
txType: string;
|
|
72
|
+
txSubType: string;
|
|
73
|
+
intention: TxIntention;
|
|
74
|
+
sequenceNumber: number;
|
|
75
|
+
userAddress: string;
|
|
76
|
+
msafeAddress: string;
|
|
77
|
+
signature: SerializedSignature;
|
|
78
|
+
}
|
|
79
|
+
|
|
68
80
|
export interface SimulationResult {
|
|
69
81
|
success: boolean;
|
|
70
82
|
errorMsg?: string;
|