@msafe/sui3-sdk 0.0.6-pre-fdcc3ff.0 → 0.0.6
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/README.md +14 -1
- package/dist/index.cjs +126 -14
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +23 -6
- package/dist/index.d.ts +23 -6
- package/dist/index.js +125 -14
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
- package/src/backend/BackendImpl.ts +126 -12
- package/src/backend/PseudoBackend.ts +66 -36
- package/src/backend/interface.ts +12 -6
- package/src/backend/types.ts +18 -0
- package/src/core/MSafeAccount.ts +9 -5
- package/src/globals/const.ts +6 -0
package/dist/index.d.cts
CHANGED
|
@@ -2,7 +2,7 @@ import * as _mysten_sui_js_src_cryptography from '@mysten/sui.js/src/cryptograph
|
|
|
2
2
|
import { PublicKey as PublicKey$1 } from '@mysten/sui.js/src/cryptography';
|
|
3
3
|
import { SuiClient, ExecuteTransactionRequestType, SuiTransactionBlockResponseOptions, SuiTransactionBlockResponse, CoinStruct, CoinMetadata, SuiObjectData } from '@mysten/sui.js/client';
|
|
4
4
|
import * as _msafe_sui3_utils from '@msafe/sui3-utils';
|
|
5
|
-
import { AuthLoginRequest, MSafeAccountInfo, UserWithOwnedMSafe, CreateMSafeAccountInfoRequest, MultisigAccountManager } from '@msafe/sui3-utils';
|
|
5
|
+
import { AuthLoginRequest, MSafeAccountInfo, UserWithOwnedMSafe, HistoryTransaction, CreateMSafeAccountInfoRequest, MultisigAccountManager } from '@msafe/sui3-utils';
|
|
6
6
|
import { PublicKey, SerializedSignature, SignatureScheme } from '@mysten/sui.js/cryptography';
|
|
7
7
|
import * as _mysten_sui_js_dist_cjs_builder from '@mysten/sui.js/dist/cjs/builder';
|
|
8
8
|
import { ModelConfig } from '@msafe/sui3-model/common';
|
|
@@ -11,6 +11,21 @@ import { TransactionBlock } from '@mysten/sui.js/transactions';
|
|
|
11
11
|
import * as _mysten_sui_js_dist_cjs_client from '@mysten/sui.js/dist/cjs/client';
|
|
12
12
|
|
|
13
13
|
type JWTToken = string;
|
|
14
|
+
interface PaginationOption {
|
|
15
|
+
page?: number;
|
|
16
|
+
pageSize: number;
|
|
17
|
+
}
|
|
18
|
+
interface PaginationResponse<T> {
|
|
19
|
+
items: T[];
|
|
20
|
+
meta: PaginationMeta;
|
|
21
|
+
}
|
|
22
|
+
interface PaginationMeta {
|
|
23
|
+
totalItems: number;
|
|
24
|
+
itemCount: number;
|
|
25
|
+
itemsPerPage: number;
|
|
26
|
+
totalPages: number;
|
|
27
|
+
currentPage: number;
|
|
28
|
+
}
|
|
14
29
|
|
|
15
30
|
interface IntentionCoinTransfer {
|
|
16
31
|
txType: 'CoinTransfer';
|
|
@@ -105,8 +120,8 @@ interface IBackend {
|
|
|
105
120
|
getMSafeAccountInfo(msafeAddress: string): Promise<MSafeAccountInfo>;
|
|
106
121
|
getUserInfo(userAddress: string): Promise<UserWithOwnedMSafe>;
|
|
107
122
|
getPendingTransactions(msafeAddress: string): Promise<PendingTx[]>;
|
|
108
|
-
getHistoryTransactions(msafeAddress: string): Promise<
|
|
109
|
-
getFutureIntentions(msafeAddress: string): Promise<FutureIntention
|
|
123
|
+
getHistoryTransactions(msafeAddress: string, paginationOption?: PaginationOption): Promise<PaginationResponse<HistoryTransaction>>;
|
|
124
|
+
getFutureIntentions(msafeAddress: string, paginationOption?: PaginationOption): Promise<PaginationResponse<FutureIntention>>;
|
|
110
125
|
getCurrentSequenceNumber(msafeAddress: string): Promise<number>;
|
|
111
126
|
getNextSequenceNumber(msafeAddress: string): Promise<number>;
|
|
112
127
|
createMSafeAccount(input: CreateMSafeAccountInfoRequest): Promise<void>;
|
|
@@ -159,6 +174,7 @@ interface MSafeConfig {
|
|
|
159
174
|
};
|
|
160
175
|
backend: DBConfig;
|
|
161
176
|
apiURL: string;
|
|
177
|
+
syncingURL: string;
|
|
162
178
|
}
|
|
163
179
|
interface MSafeConfigOptions {
|
|
164
180
|
suiClient?: {
|
|
@@ -173,6 +189,7 @@ declare const DEV_DATABASE_CONFIG: DBConfig;
|
|
|
173
189
|
declare const TESTNET_RPC_URL = "https://sui-testnet.blockvision.org/v1/2Sgk89ivT64MnKdcGzjmyjY2ndD";
|
|
174
190
|
declare const MAINNET_RPC_URL = "https://sui-mainnet.blockvision.org/v1/2Sgk7NPvqkd7mESYkxF01yX15l7";
|
|
175
191
|
declare const LOCAL_API_URL = "http://127.0.0.1:3000";
|
|
192
|
+
declare const LOCAL_SYNCING_URL = "http://127.0.0.1:3001";
|
|
176
193
|
declare const DEV_API_URL = "http://13.56.226.148";
|
|
177
194
|
declare const ENV_CONFIGS: Map<MSafeEnv, MSafeConfig>;
|
|
178
195
|
declare function getMSafeConfig(env: MSafeEnv, options?: MSafeConfigOptions): MSafeConfig;
|
|
@@ -276,8 +293,8 @@ declare class MSafeAccount {
|
|
|
276
293
|
constructor(globals: MSafeGlobals, info: MSafeAccountInfo);
|
|
277
294
|
static new(globals: MSafeGlobals, address: string): Promise<MSafeAccount>;
|
|
278
295
|
pendingTransactions(): Promise<PendingTx[]>;
|
|
279
|
-
historyTransaction(): Promise<
|
|
280
|
-
futureIntentions(): Promise<FutureIntention[]>;
|
|
296
|
+
historyTransaction(paginationOption?: PaginationOption): Promise<_msafe_sui3_utils.HistoryTransaction[]>;
|
|
297
|
+
futureIntentions(paginationOption?: PaginationOption): Promise<FutureIntention[]>;
|
|
281
298
|
currentSequenceNumber(): Promise<number>;
|
|
282
299
|
nextSequenceNumber(): Promise<number>;
|
|
283
300
|
proposeIntention(intention: TxIntention, sequenceNumber: number): Promise<void>;
|
|
@@ -388,4 +405,4 @@ declare class Coin {
|
|
|
388
405
|
static getBalance(data: SuiObjectData): bigint | undefined;
|
|
389
406
|
}
|
|
390
407
|
|
|
391
|
-
export { AUTH_SIGN_MESSAGE, COIN_TYPE_ARG_REGEX, Coin, CoinHelper, CreateHelper, type CreateMSafeAccountInfo, type CreatePermissionInfo, type DBConfig, DEV_API_URL, DEV_DATABASE_CONFIG, ENV_CONFIGS, Formatter, type FutureIntention, HexToUint8Array, type HistorySendTx, type HistoryVote, type IWallet, IntentionHelper, LOCAL_API_URL, LOCAL_DATABASE_CONFIG, MAINNET_RPC_URL, MSafeAccount, MSafeClient, type MSafeConfig, type MSafeConfigOptions, MSafeEnv, MSafeGlobals, MessageHelper, type PendingTx, type PendingVote, PublicKeySerde, type ReceiveTransaction, SUI_COIN, SignatureVerifier, TESTNET_RPC_URL, type TxIntention, UNIT_DATABASE_CONFIG, Uint8ArrayToHex, getAllCoins, getMSafeConfig, getPublicKeyFromChain, stringToBuffer };
|
|
408
|
+
export { AUTH_SIGN_MESSAGE, COIN_TYPE_ARG_REGEX, Coin, CoinHelper, CreateHelper, type CreateMSafeAccountInfo, type CreatePermissionInfo, type DBConfig, DEV_API_URL, DEV_DATABASE_CONFIG, ENV_CONFIGS, Formatter, type FutureIntention, HexToUint8Array, type HistorySendTx, type HistoryVote, type IWallet, IntentionHelper, LOCAL_API_URL, LOCAL_DATABASE_CONFIG, LOCAL_SYNCING_URL, MAINNET_RPC_URL, MSafeAccount, MSafeClient, type MSafeConfig, type MSafeConfigOptions, MSafeEnv, MSafeGlobals, MessageHelper, type PendingTx, type PendingVote, PublicKeySerde, type ReceiveTransaction, SUI_COIN, SignatureVerifier, TESTNET_RPC_URL, type TxIntention, UNIT_DATABASE_CONFIG, Uint8ArrayToHex, getAllCoins, getMSafeConfig, getPublicKeyFromChain, stringToBuffer };
|
package/dist/index.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import * as _mysten_sui_js_src_cryptography from '@mysten/sui.js/src/cryptograph
|
|
|
2
2
|
import { PublicKey as PublicKey$1 } from '@mysten/sui.js/src/cryptography';
|
|
3
3
|
import { SuiClient, ExecuteTransactionRequestType, SuiTransactionBlockResponseOptions, SuiTransactionBlockResponse, CoinStruct, CoinMetadata, SuiObjectData } from '@mysten/sui.js/client';
|
|
4
4
|
import * as _msafe_sui3_utils from '@msafe/sui3-utils';
|
|
5
|
-
import { AuthLoginRequest, MSafeAccountInfo, UserWithOwnedMSafe, CreateMSafeAccountInfoRequest, MultisigAccountManager } from '@msafe/sui3-utils';
|
|
5
|
+
import { AuthLoginRequest, MSafeAccountInfo, UserWithOwnedMSafe, HistoryTransaction, CreateMSafeAccountInfoRequest, MultisigAccountManager } from '@msafe/sui3-utils';
|
|
6
6
|
import { PublicKey, SerializedSignature, SignatureScheme } from '@mysten/sui.js/cryptography';
|
|
7
7
|
import * as _mysten_sui_js_dist_cjs_builder from '@mysten/sui.js/dist/cjs/builder';
|
|
8
8
|
import { ModelConfig } from '@msafe/sui3-model/common';
|
|
@@ -11,6 +11,21 @@ import { TransactionBlock } from '@mysten/sui.js/transactions';
|
|
|
11
11
|
import * as _mysten_sui_js_dist_cjs_client from '@mysten/sui.js/dist/cjs/client';
|
|
12
12
|
|
|
13
13
|
type JWTToken = string;
|
|
14
|
+
interface PaginationOption {
|
|
15
|
+
page?: number;
|
|
16
|
+
pageSize: number;
|
|
17
|
+
}
|
|
18
|
+
interface PaginationResponse<T> {
|
|
19
|
+
items: T[];
|
|
20
|
+
meta: PaginationMeta;
|
|
21
|
+
}
|
|
22
|
+
interface PaginationMeta {
|
|
23
|
+
totalItems: number;
|
|
24
|
+
itemCount: number;
|
|
25
|
+
itemsPerPage: number;
|
|
26
|
+
totalPages: number;
|
|
27
|
+
currentPage: number;
|
|
28
|
+
}
|
|
14
29
|
|
|
15
30
|
interface IntentionCoinTransfer {
|
|
16
31
|
txType: 'CoinTransfer';
|
|
@@ -105,8 +120,8 @@ interface IBackend {
|
|
|
105
120
|
getMSafeAccountInfo(msafeAddress: string): Promise<MSafeAccountInfo>;
|
|
106
121
|
getUserInfo(userAddress: string): Promise<UserWithOwnedMSafe>;
|
|
107
122
|
getPendingTransactions(msafeAddress: string): Promise<PendingTx[]>;
|
|
108
|
-
getHistoryTransactions(msafeAddress: string): Promise<
|
|
109
|
-
getFutureIntentions(msafeAddress: string): Promise<FutureIntention
|
|
123
|
+
getHistoryTransactions(msafeAddress: string, paginationOption?: PaginationOption): Promise<PaginationResponse<HistoryTransaction>>;
|
|
124
|
+
getFutureIntentions(msafeAddress: string, paginationOption?: PaginationOption): Promise<PaginationResponse<FutureIntention>>;
|
|
110
125
|
getCurrentSequenceNumber(msafeAddress: string): Promise<number>;
|
|
111
126
|
getNextSequenceNumber(msafeAddress: string): Promise<number>;
|
|
112
127
|
createMSafeAccount(input: CreateMSafeAccountInfoRequest): Promise<void>;
|
|
@@ -159,6 +174,7 @@ interface MSafeConfig {
|
|
|
159
174
|
};
|
|
160
175
|
backend: DBConfig;
|
|
161
176
|
apiURL: string;
|
|
177
|
+
syncingURL: string;
|
|
162
178
|
}
|
|
163
179
|
interface MSafeConfigOptions {
|
|
164
180
|
suiClient?: {
|
|
@@ -173,6 +189,7 @@ declare const DEV_DATABASE_CONFIG: DBConfig;
|
|
|
173
189
|
declare const TESTNET_RPC_URL = "https://sui-testnet.blockvision.org/v1/2Sgk89ivT64MnKdcGzjmyjY2ndD";
|
|
174
190
|
declare const MAINNET_RPC_URL = "https://sui-mainnet.blockvision.org/v1/2Sgk7NPvqkd7mESYkxF01yX15l7";
|
|
175
191
|
declare const LOCAL_API_URL = "http://127.0.0.1:3000";
|
|
192
|
+
declare const LOCAL_SYNCING_URL = "http://127.0.0.1:3001";
|
|
176
193
|
declare const DEV_API_URL = "http://13.56.226.148";
|
|
177
194
|
declare const ENV_CONFIGS: Map<MSafeEnv, MSafeConfig>;
|
|
178
195
|
declare function getMSafeConfig(env: MSafeEnv, options?: MSafeConfigOptions): MSafeConfig;
|
|
@@ -276,8 +293,8 @@ declare class MSafeAccount {
|
|
|
276
293
|
constructor(globals: MSafeGlobals, info: MSafeAccountInfo);
|
|
277
294
|
static new(globals: MSafeGlobals, address: string): Promise<MSafeAccount>;
|
|
278
295
|
pendingTransactions(): Promise<PendingTx[]>;
|
|
279
|
-
historyTransaction(): Promise<
|
|
280
|
-
futureIntentions(): Promise<FutureIntention[]>;
|
|
296
|
+
historyTransaction(paginationOption?: PaginationOption): Promise<_msafe_sui3_utils.HistoryTransaction[]>;
|
|
297
|
+
futureIntentions(paginationOption?: PaginationOption): Promise<FutureIntention[]>;
|
|
281
298
|
currentSequenceNumber(): Promise<number>;
|
|
282
299
|
nextSequenceNumber(): Promise<number>;
|
|
283
300
|
proposeIntention(intention: TxIntention, sequenceNumber: number): Promise<void>;
|
|
@@ -388,4 +405,4 @@ declare class Coin {
|
|
|
388
405
|
static getBalance(data: SuiObjectData): bigint | undefined;
|
|
389
406
|
}
|
|
390
407
|
|
|
391
|
-
export { AUTH_SIGN_MESSAGE, COIN_TYPE_ARG_REGEX, Coin, CoinHelper, CreateHelper, type CreateMSafeAccountInfo, type CreatePermissionInfo, type DBConfig, DEV_API_URL, DEV_DATABASE_CONFIG, ENV_CONFIGS, Formatter, type FutureIntention, HexToUint8Array, type HistorySendTx, type HistoryVote, type IWallet, IntentionHelper, LOCAL_API_URL, LOCAL_DATABASE_CONFIG, MAINNET_RPC_URL, MSafeAccount, MSafeClient, type MSafeConfig, type MSafeConfigOptions, MSafeEnv, MSafeGlobals, MessageHelper, type PendingTx, type PendingVote, PublicKeySerde, type ReceiveTransaction, SUI_COIN, SignatureVerifier, TESTNET_RPC_URL, type TxIntention, UNIT_DATABASE_CONFIG, Uint8ArrayToHex, getAllCoins, getMSafeConfig, getPublicKeyFromChain, stringToBuffer };
|
|
408
|
+
export { AUTH_SIGN_MESSAGE, COIN_TYPE_ARG_REGEX, Coin, CoinHelper, CreateHelper, type CreateMSafeAccountInfo, type CreatePermissionInfo, type DBConfig, DEV_API_URL, DEV_DATABASE_CONFIG, ENV_CONFIGS, Formatter, type FutureIntention, HexToUint8Array, type HistorySendTx, type HistoryVote, type IWallet, IntentionHelper, LOCAL_API_URL, LOCAL_DATABASE_CONFIG, LOCAL_SYNCING_URL, MAINNET_RPC_URL, MSafeAccount, MSafeClient, type MSafeConfig, type MSafeConfigOptions, MSafeEnv, MSafeGlobals, MessageHelper, type PendingTx, type PendingVote, PublicKeySerde, type ReceiveTransaction, SUI_COIN, SignatureVerifier, TESTNET_RPC_URL, type TxIntention, UNIT_DATABASE_CONFIG, Uint8ArrayToHex, getAllCoins, getMSafeConfig, getPublicKeyFromChain, stringToBuffer };
|
package/dist/index.js
CHANGED
|
@@ -517,11 +517,13 @@ var MSafeAccount = class _MSafeAccount {
|
|
|
517
517
|
async pendingTransactions() {
|
|
518
518
|
return this.backend.getPendingTransactions(this.address);
|
|
519
519
|
}
|
|
520
|
-
async historyTransaction() {
|
|
521
|
-
|
|
520
|
+
async historyTransaction(paginationOption) {
|
|
521
|
+
const paginatedHistoryTransactions = await this.backend.getHistoryTransactions(this.address, paginationOption);
|
|
522
|
+
return paginatedHistoryTransactions.items;
|
|
522
523
|
}
|
|
523
|
-
async futureIntentions() {
|
|
524
|
-
|
|
524
|
+
async futureIntentions(paginationOption) {
|
|
525
|
+
const paginatedIntentions = await this.backend.getFutureIntentions(this.address, paginationOption);
|
|
526
|
+
return paginatedIntentions.items;
|
|
525
527
|
}
|
|
526
528
|
async currentSequenceNumber() {
|
|
527
529
|
return this.backend.getCurrentSequenceNumber(this.address);
|
|
@@ -746,6 +748,7 @@ var DEV_DATABASE_CONFIG = {
|
|
|
746
748
|
var TESTNET_RPC_URL = "https://sui-testnet.blockvision.org/v1/2Sgk89ivT64MnKdcGzjmyjY2ndD";
|
|
747
749
|
var MAINNET_RPC_URL = "https://sui-mainnet.blockvision.org/v1/2Sgk7NPvqkd7mESYkxF01yX15l7";
|
|
748
750
|
var LOCAL_API_URL = "http://127.0.0.1:3000";
|
|
751
|
+
var LOCAL_SYNCING_URL = "http://127.0.0.1:3001";
|
|
749
752
|
var DEV_API_URL = "http://13.56.226.148";
|
|
750
753
|
var ENV_CONFIGS = /* @__PURE__ */ new Map([
|
|
751
754
|
[
|
|
@@ -755,7 +758,8 @@ var ENV_CONFIGS = /* @__PURE__ */ new Map([
|
|
|
755
758
|
url: TESTNET_RPC_URL
|
|
756
759
|
},
|
|
757
760
|
backend: LOCAL_DATABASE_CONFIG,
|
|
758
|
-
apiURL: LOCAL_API_URL
|
|
761
|
+
apiURL: LOCAL_API_URL,
|
|
762
|
+
syncingURL: LOCAL_SYNCING_URL
|
|
759
763
|
}
|
|
760
764
|
],
|
|
761
765
|
[
|
|
@@ -765,7 +769,8 @@ var ENV_CONFIGS = /* @__PURE__ */ new Map([
|
|
|
765
769
|
url: TESTNET_RPC_URL
|
|
766
770
|
},
|
|
767
771
|
backend: LOCAL_DATABASE_CONFIG,
|
|
768
|
-
apiURL: LOCAL_API_URL
|
|
772
|
+
apiURL: LOCAL_API_URL,
|
|
773
|
+
syncingURL: LOCAL_SYNCING_URL
|
|
769
774
|
}
|
|
770
775
|
],
|
|
771
776
|
[
|
|
@@ -775,7 +780,8 @@ var ENV_CONFIGS = /* @__PURE__ */ new Map([
|
|
|
775
780
|
url: TESTNET_RPC_URL
|
|
776
781
|
},
|
|
777
782
|
backend: DEV_DATABASE_CONFIG,
|
|
778
|
-
apiURL: DEV_API_URL
|
|
783
|
+
apiURL: DEV_API_URL,
|
|
784
|
+
syncingURL: LOCAL_SYNCING_URL
|
|
779
785
|
}
|
|
780
786
|
]
|
|
781
787
|
]);
|
|
@@ -887,19 +893,63 @@ var BackendImpl = class {
|
|
|
887
893
|
};
|
|
888
894
|
}
|
|
889
895
|
async getPendingTransactions(msafeAddress) {
|
|
890
|
-
|
|
896
|
+
const res = await axios.get(`${this.apiURL}/transaction/pending/${msafeAddress}`, {
|
|
897
|
+
headers: this.headers()
|
|
898
|
+
});
|
|
899
|
+
if (res.status !== 200 && res.status !== 201) {
|
|
900
|
+
throw new Error(`invalid getPublicKeyBatch return: ${res}`);
|
|
901
|
+
}
|
|
902
|
+
return res.data;
|
|
891
903
|
}
|
|
892
|
-
async getHistoryTransactions(msafeAddress) {
|
|
893
|
-
|
|
904
|
+
async getHistoryTransactions(msafeAddress, paginationOption) {
|
|
905
|
+
const res = await axios.get(
|
|
906
|
+
`${this.apiURL}/transaction/history?address=${msafeAddress}`,
|
|
907
|
+
{
|
|
908
|
+
params: {
|
|
909
|
+
page: paginationOption?.page,
|
|
910
|
+
limit: paginationOption?.pageSize
|
|
911
|
+
},
|
|
912
|
+
headers: this.headers()
|
|
913
|
+
}
|
|
914
|
+
);
|
|
915
|
+
if (res.status !== 200 && res.status !== 201) {
|
|
916
|
+
throw new Error(`invalid getCurrentSequenceNumber return: ${res}`);
|
|
917
|
+
}
|
|
918
|
+
return res.data;
|
|
894
919
|
}
|
|
895
|
-
async getFutureIntentions(msafeAddress) {
|
|
896
|
-
|
|
920
|
+
async getFutureIntentions(msafeAddress, paginationOption) {
|
|
921
|
+
const res = await axios.get(
|
|
922
|
+
`${this.apiURL}/transaction/intention/${msafeAddress}`,
|
|
923
|
+
{
|
|
924
|
+
params: {
|
|
925
|
+
page: paginationOption?.page,
|
|
926
|
+
limit: paginationOption?.pageSize
|
|
927
|
+
},
|
|
928
|
+
headers: this.headers()
|
|
929
|
+
}
|
|
930
|
+
);
|
|
931
|
+
if (res.status !== 200 && res.status !== 201) {
|
|
932
|
+
throw new Error(`invalid getCurrentSequenceNumber return: ${res}`);
|
|
933
|
+
}
|
|
934
|
+
return res.data;
|
|
897
935
|
}
|
|
898
936
|
async getCurrentSequenceNumber(msafeAddress) {
|
|
899
|
-
|
|
937
|
+
const res = await axios.get(`${this.apiURL}/transaction/sn/current/${msafeAddress}`, {
|
|
938
|
+
headers: this.headers()
|
|
939
|
+
});
|
|
940
|
+
if (res.status !== 200 && res.status !== 201) {
|
|
941
|
+
throw new Error(`invalid getCurrentSequenceNumber return: ${res}`);
|
|
942
|
+
}
|
|
943
|
+
return res.data;
|
|
900
944
|
}
|
|
901
945
|
async getNextSequenceNumber(msafeAddress) {
|
|
902
|
-
|
|
946
|
+
const res = await axios.get(`${this.apiURL}/transaction/sn/next/${msafeAddress}`, {
|
|
947
|
+
headers: this.headers()
|
|
948
|
+
});
|
|
949
|
+
if (res.status !== 200 && res.status !== 201) {
|
|
950
|
+
throw new Error(`invalid getNextSequenceNumber return: ${res}`);
|
|
951
|
+
}
|
|
952
|
+
return res.data;
|
|
903
953
|
}
|
|
904
954
|
async createMSafeAccount(input) {
|
|
905
955
|
const res = await axios.post(`${this.apiURL}/account`, input, {
|
|
@@ -910,14 +960,74 @@ var BackendImpl = class {
|
|
|
910
960
|
}
|
|
911
961
|
}
|
|
912
962
|
async proposeIntention(input) {
|
|
963
|
+
try {
|
|
964
|
+
const res = await axios.post(
|
|
965
|
+
`${this.apiURL}/transaction/intention`,
|
|
966
|
+
{
|
|
967
|
+
intention: input.intention,
|
|
968
|
+
sequenceNumber: input.sequenceNumber,
|
|
969
|
+
address: input.msafeAddress,
|
|
970
|
+
signature: input.signature
|
|
971
|
+
},
|
|
972
|
+
{ headers: this.headers() }
|
|
973
|
+
);
|
|
974
|
+
if (res.status !== 200 && res.status !== 201) {
|
|
975
|
+
throw new Error(`invalid proposeIntention return: ${res}`);
|
|
976
|
+
}
|
|
977
|
+
} catch (e) {
|
|
978
|
+
console.log(e);
|
|
979
|
+
}
|
|
913
980
|
}
|
|
981
|
+
// TODO later
|
|
914
982
|
async proposePendingTransaction(input) {
|
|
915
983
|
}
|
|
916
984
|
async rejectCurrentTx(input) {
|
|
985
|
+
try {
|
|
986
|
+
const res = await axios.post(
|
|
987
|
+
`${this.apiURL}/transaction/pending/reject`,
|
|
988
|
+
{
|
|
989
|
+
address: input.msafeAddress,
|
|
990
|
+
digest: input.digest,
|
|
991
|
+
signature: input.signature
|
|
992
|
+
},
|
|
993
|
+
{
|
|
994
|
+
headers: this.headers()
|
|
995
|
+
}
|
|
996
|
+
);
|
|
997
|
+
if (res.status !== 200 && res.status !== 201) {
|
|
998
|
+
throw new Error(`invalid voteForTransaction return: ${res}`);
|
|
999
|
+
}
|
|
1000
|
+
} catch (e) {
|
|
1001
|
+
console.log("e:", e);
|
|
1002
|
+
}
|
|
917
1003
|
}
|
|
918
1004
|
async voteForTransaction(input) {
|
|
1005
|
+
const res = await axios.post(
|
|
1006
|
+
`${this.apiURL}/transaction/pending/vote`,
|
|
1007
|
+
{
|
|
1008
|
+
address: input.msafeAddress,
|
|
1009
|
+
digest: input.txDigest,
|
|
1010
|
+
signature: input.signature
|
|
1011
|
+
},
|
|
1012
|
+
{
|
|
1013
|
+
headers: this.headers()
|
|
1014
|
+
}
|
|
1015
|
+
);
|
|
1016
|
+
if (res.status !== 200 && res.status !== 201) {
|
|
1017
|
+
throw new Error(`invalid voteForTransaction return: ${res}`);
|
|
1018
|
+
}
|
|
919
1019
|
}
|
|
920
1020
|
async buildNextIntentionAndAddToPending(input) {
|
|
1021
|
+
const res = await axios.post(
|
|
1022
|
+
`${this.apiURL}/transaction/pending/build`,
|
|
1023
|
+
{
|
|
1024
|
+
address: input.msafeAddress
|
|
1025
|
+
},
|
|
1026
|
+
{ headers: this.headers() }
|
|
1027
|
+
);
|
|
1028
|
+
if (res.status !== 200 && res.status !== 201) {
|
|
1029
|
+
throw new Error(`invalid buildNextIntentionAndAddToPending return: ${res}`);
|
|
1030
|
+
}
|
|
921
1031
|
}
|
|
922
1032
|
async skipNextFailedIntention(input) {
|
|
923
1033
|
}
|
|
@@ -1041,6 +1151,7 @@ export {
|
|
|
1041
1151
|
IntentionHelper,
|
|
1042
1152
|
LOCAL_API_URL,
|
|
1043
1153
|
LOCAL_DATABASE_CONFIG,
|
|
1154
|
+
LOCAL_SYNCING_URL,
|
|
1044
1155
|
MAINNET_RPC_URL,
|
|
1045
1156
|
MSafeAccount,
|
|
1046
1157
|
MSafeClient,
|