@msafe/sui3-sdk 0.0.10 → 0.0.11-pre-a4487d7.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 +278 -109
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +28 -7
- package/dist/index.d.ts +28 -7
- package/dist/index.js +278 -109
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
- package/src/backend/BackendImpl.ts +11 -13
- package/src/backend/PseudoBackend.ts +10 -3
- package/src/backend/interface.ts +4 -7
- package/src/core/MSafeAccount.ts +68 -10
- package/src/globals/MSafeGlobals.ts +1 -2
- package/src/types/assets.ts +7 -0
- package/src/types/msafe.ts +5 -1
- package/src/utils/iter/iterator.ts +90 -0
- package/src/utils/iter/object.ts +179 -0
- package/src/utils/iter/requester.ts +8 -0
package/dist/index.cjs
CHANGED
|
@@ -597,7 +597,137 @@ var AddressBookSDK = class {
|
|
|
597
597
|
|
|
598
598
|
// src/core/MSafeAccount.ts
|
|
599
599
|
var import_sui3_utils2 = require("@msafe/sui3-utils");
|
|
600
|
-
var
|
|
600
|
+
var import_utils5 = require("@mysten/sui.js/utils");
|
|
601
|
+
|
|
602
|
+
// src/utils/iter/iterator.ts
|
|
603
|
+
var REQUEST_PAGE_SIZE = 25;
|
|
604
|
+
async function getAllFromIterator(it) {
|
|
605
|
+
const res = [];
|
|
606
|
+
while (await it.hasNext()) {
|
|
607
|
+
const val = await it.next();
|
|
608
|
+
res.push(val);
|
|
609
|
+
}
|
|
610
|
+
if (res && Array.isArray(res[0])) {
|
|
611
|
+
return res.flat(1);
|
|
612
|
+
}
|
|
613
|
+
return res;
|
|
614
|
+
}
|
|
615
|
+
var PagedIterator = class {
|
|
616
|
+
constructor(requester) {
|
|
617
|
+
this.requester = requester;
|
|
618
|
+
this.curPage = void 0;
|
|
619
|
+
this.init = true;
|
|
620
|
+
}
|
|
621
|
+
curPage;
|
|
622
|
+
init;
|
|
623
|
+
async hasNext() {
|
|
624
|
+
if (this.init) {
|
|
625
|
+
if (!this.curPage) {
|
|
626
|
+
this.curPage = await this.requester.doNextRequest();
|
|
627
|
+
}
|
|
628
|
+
return !!this.curPage.data?.length || this.curPage.hasNext;
|
|
629
|
+
}
|
|
630
|
+
if (!this.curPage) {
|
|
631
|
+
throw new Error("invalid implementation of iterator");
|
|
632
|
+
}
|
|
633
|
+
return this.curPage.hasNext;
|
|
634
|
+
}
|
|
635
|
+
async next() {
|
|
636
|
+
if (this.init) {
|
|
637
|
+
this.init = false;
|
|
638
|
+
if (!this.curPage) {
|
|
639
|
+
this.curPage = await this.requester.doNextRequest();
|
|
640
|
+
}
|
|
641
|
+
return this.curPage.data;
|
|
642
|
+
}
|
|
643
|
+
this.curPage = await this.requester.doNextRequest();
|
|
644
|
+
return this.curPage.data;
|
|
645
|
+
}
|
|
646
|
+
};
|
|
647
|
+
var EntryIterator = class {
|
|
648
|
+
constructor(requester) {
|
|
649
|
+
this.requester = requester;
|
|
650
|
+
this.pager = new PagedIterator(requester);
|
|
651
|
+
this.curData = [];
|
|
652
|
+
this.cursor = 0;
|
|
653
|
+
}
|
|
654
|
+
cursor;
|
|
655
|
+
pager;
|
|
656
|
+
curData;
|
|
657
|
+
async hasNext() {
|
|
658
|
+
if (this.cursor < this.curData.length - 1) {
|
|
659
|
+
return true;
|
|
660
|
+
}
|
|
661
|
+
return this.pager.hasNext();
|
|
662
|
+
}
|
|
663
|
+
async next() {
|
|
664
|
+
this.cursor += 1;
|
|
665
|
+
while (this.cursor >= this.curData.length) {
|
|
666
|
+
if (!await this.pager.hasNext()) {
|
|
667
|
+
throw new Error("not more data");
|
|
668
|
+
} else {
|
|
669
|
+
this.curData = await this.pager.next();
|
|
670
|
+
this.cursor = 0;
|
|
671
|
+
}
|
|
672
|
+
}
|
|
673
|
+
return this.curData[this.cursor];
|
|
674
|
+
}
|
|
675
|
+
};
|
|
676
|
+
|
|
677
|
+
// src/utils/iter/object.ts
|
|
678
|
+
async function getAllOwnedObjects(provider, owner, options) {
|
|
679
|
+
const iter = new OwnedObjectIterator(provider, owner, options);
|
|
680
|
+
return await getAllFromIterator(iter);
|
|
681
|
+
}
|
|
682
|
+
var OwnedObjectIterator = class extends EntryIterator {
|
|
683
|
+
constructor(provider, owner, options) {
|
|
684
|
+
super(new OwnedObjectRequester(provider, owner, options));
|
|
685
|
+
this.provider = provider;
|
|
686
|
+
this.owner = owner;
|
|
687
|
+
this.options = options;
|
|
688
|
+
}
|
|
689
|
+
};
|
|
690
|
+
var OwnedObjectRequester = class {
|
|
691
|
+
constructor(provider, owner, options) {
|
|
692
|
+
this.provider = provider;
|
|
693
|
+
this.owner = owner;
|
|
694
|
+
this.options = options;
|
|
695
|
+
this.nextCursor = null;
|
|
696
|
+
this.filter = options?.filter;
|
|
697
|
+
this.pageSize = options?.pageSize || REQUEST_PAGE_SIZE;
|
|
698
|
+
this.objectOptions = options?.objectOptions || {
|
|
699
|
+
showType: true,
|
|
700
|
+
showContent: true
|
|
701
|
+
};
|
|
702
|
+
}
|
|
703
|
+
nextCursor;
|
|
704
|
+
filter;
|
|
705
|
+
pageSize;
|
|
706
|
+
objectOptions;
|
|
707
|
+
async doNextRequest() {
|
|
708
|
+
const res = await this.provider.getOwnedObjects({
|
|
709
|
+
owner: this.owner,
|
|
710
|
+
options: this.objectOptions,
|
|
711
|
+
cursor: this.nextCursor,
|
|
712
|
+
limit: this.pageSize
|
|
713
|
+
});
|
|
714
|
+
this.nextCursor = res.nextCursor;
|
|
715
|
+
let filtered;
|
|
716
|
+
if (this.filter) {
|
|
717
|
+
const { filter } = this;
|
|
718
|
+
filtered = res.data.filter((obj) => filter?.(obj));
|
|
719
|
+
} else {
|
|
720
|
+
filtered = res.data;
|
|
721
|
+
}
|
|
722
|
+
return {
|
|
723
|
+
data: filtered.map((r) => r.data).filter((data) => data),
|
|
724
|
+
hasNext: res.hasNextPage
|
|
725
|
+
};
|
|
726
|
+
}
|
|
727
|
+
};
|
|
728
|
+
|
|
729
|
+
// src/core/MSafeAccount.ts
|
|
730
|
+
var MSafeAccount = class {
|
|
601
731
|
constructor(globals, info) {
|
|
602
732
|
this.globals = globals;
|
|
603
733
|
this.info = info;
|
|
@@ -606,22 +736,57 @@ var MSafeAccount = class _MSafeAccount {
|
|
|
606
736
|
ownersWithWeight: info.ownersWithWeightPK,
|
|
607
737
|
creationNonce: info.creationNonce
|
|
608
738
|
});
|
|
739
|
+
this.coinHelper = new CoinHelper(this.suiClient);
|
|
609
740
|
}
|
|
610
741
|
multisigManager;
|
|
742
|
+
coinHelper;
|
|
611
743
|
static async new(globals, address) {
|
|
612
|
-
|
|
613
|
-
|
|
744
|
+
return globals.backend.getMSafeAccountInfo(address);
|
|
745
|
+
}
|
|
746
|
+
async ownedCoins() {
|
|
747
|
+
const balances = await this.suiClient.getAllBalances({ owner: this.address });
|
|
748
|
+
return Promise.all(
|
|
749
|
+
balances.map(async (balance) => {
|
|
750
|
+
const meta = await this.coinHelper.getCoinMeta(balance.coinType);
|
|
751
|
+
const unlockedBalance = balance.lockedBalance.number ? BigInt(balance.totalBalance) - BigInt(balance.lockedBalance.number) : BigInt(balance.totalBalance);
|
|
752
|
+
return {
|
|
753
|
+
type: (0, import_utils5.normalizeStructTag)(balance.coinType),
|
|
754
|
+
balance: BigInt(unlockedBalance),
|
|
755
|
+
metadata: meta
|
|
756
|
+
};
|
|
757
|
+
})
|
|
758
|
+
);
|
|
759
|
+
}
|
|
760
|
+
async ownedObjects(options) {
|
|
761
|
+
return getAllOwnedObjects(this.suiClient, this.address, options);
|
|
614
762
|
}
|
|
615
763
|
async pendingTransactions() {
|
|
616
764
|
return this.backend.getPendingTransactions(this.address);
|
|
617
765
|
}
|
|
766
|
+
async pendingTransaction() {
|
|
767
|
+
const pendings = await this.backend.getPendingTransactions(this.address);
|
|
768
|
+
if (pendings.length > 2) {
|
|
769
|
+
throw new Error(`invalid backend getPendingTransactions resp, length should not > 2: ${pendings}`);
|
|
770
|
+
}
|
|
771
|
+
if (pendings.length === 0) {
|
|
772
|
+
return void 0;
|
|
773
|
+
}
|
|
774
|
+
if (pendings.length === 1) {
|
|
775
|
+
return pendings[0];
|
|
776
|
+
}
|
|
777
|
+
const [rejectPending, pendingTx] = pendings[0].isRejectTx ? [pendings[0], pendings[1]] : [pendings[1], pendings[0]];
|
|
778
|
+
pendingTx.rejectDigest = rejectPending.digest;
|
|
779
|
+
pendingTx.rejectPayload = rejectPending.payload;
|
|
780
|
+
pendingTx.rejectVotes = rejectPending.votes;
|
|
781
|
+
return pendingTx;
|
|
782
|
+
}
|
|
618
783
|
async historyTransaction(paginationOption) {
|
|
619
784
|
const paginatedHistoryTransactions = await this.backend.getHistoryTransactions(this.address, paginationOption);
|
|
620
|
-
return paginatedHistoryTransactions.
|
|
785
|
+
return paginatedHistoryTransactions.data;
|
|
621
786
|
}
|
|
622
787
|
async futureIntentions(paginationOption) {
|
|
623
788
|
const paginatedIntentions = await this.backend.getFutureIntentions(this.address, paginationOption);
|
|
624
|
-
return paginatedIntentions.
|
|
789
|
+
return paginatedIntentions.data;
|
|
625
790
|
}
|
|
626
791
|
async currentSequenceNumber() {
|
|
627
792
|
return this.backend.getCurrentSequenceNumber(this.address);
|
|
@@ -679,11 +844,11 @@ var MSafeAccount = class _MSafeAccount {
|
|
|
679
844
|
}
|
|
680
845
|
payloadToReject = pending.payload;
|
|
681
846
|
} else {
|
|
682
|
-
const
|
|
683
|
-
if (
|
|
847
|
+
const pendingTx = await this.pendingTransaction();
|
|
848
|
+
if (!pendingTx || pendingTx?.rejectDigest !== void 0) {
|
|
684
849
|
throw new Error("Already rejected");
|
|
685
850
|
}
|
|
686
|
-
payloadToReject =
|
|
851
|
+
payloadToReject = pendingTx.payload;
|
|
687
852
|
}
|
|
688
853
|
const rejectTxb = await IntentionHelper.buildRejectTransaction({
|
|
689
854
|
msafeAddress: this.address,
|
|
@@ -706,11 +871,18 @@ var MSafeAccount = class _MSafeAccount {
|
|
|
706
871
|
return this.backend.skipNextFailedIntention({ msafeAddress: this.address, userAddress: await this.userAddress() });
|
|
707
872
|
}
|
|
708
873
|
async executePendingTx(pending) {
|
|
709
|
-
|
|
874
|
+
let gotSigs;
|
|
875
|
+
let payload;
|
|
876
|
+
if (pending.votes.length >= this.info.threshold) {
|
|
877
|
+
gotSigs = new Map(pending.votes.map((vote) => [vote.userAddress, vote.signature]));
|
|
878
|
+
payload = pending.payload;
|
|
879
|
+
} else if (pending.rejectVotes && pending.rejectPayload && pending.rejectVotes?.length >= this.info.threshold) {
|
|
880
|
+
gotSigs = new Map(pending.rejectVotes.map((vote) => [vote.userAddress, vote.signature]));
|
|
881
|
+
payload = pending.rejectPayload;
|
|
882
|
+
} else {
|
|
710
883
|
throw new Error("Not enough signatures");
|
|
711
884
|
}
|
|
712
885
|
const sigs = [];
|
|
713
|
-
const gotSigs = new Map(pending.votes.map((vote) => [vote.userAddress, vote.signature]));
|
|
714
886
|
for (let i = 0; i < this.info.ownersWithWeightPK.length; i++) {
|
|
715
887
|
const owner = this.info.ownersWithWeightPK[i];
|
|
716
888
|
const signature = gotSigs.get(owner.publicKey.toSuiAddress());
|
|
@@ -720,7 +892,7 @@ var MSafeAccount = class _MSafeAccount {
|
|
|
720
892
|
}
|
|
721
893
|
const multiSignature = this.multisigManager.combinePartialSignatures(sigs);
|
|
722
894
|
return this.suiClient.executeTransactionBlock({
|
|
723
|
-
transactionBlock: HexToUint8Array(
|
|
895
|
+
transactionBlock: HexToUint8Array(payload),
|
|
724
896
|
signature: multiSignature,
|
|
725
897
|
options: { showEffects: true }
|
|
726
898
|
});
|
|
@@ -811,94 +983,6 @@ var PublicKeyHelper = class {
|
|
|
811
983
|
// src/globals/MSafeGlobals.ts
|
|
812
984
|
var import_client = require("@mysten/sui.js/client");
|
|
813
985
|
|
|
814
|
-
// src/globals/const.ts
|
|
815
|
-
var MSafeEnv = /* @__PURE__ */ ((MSafeEnv3) => {
|
|
816
|
-
MSafeEnv3["local"] = "local";
|
|
817
|
-
MSafeEnv3["unit"] = "unit";
|
|
818
|
-
MSafeEnv3["dev"] = "dev";
|
|
819
|
-
MSafeEnv3["prev"] = "prev";
|
|
820
|
-
MSafeEnv3["prod"] = "prod";
|
|
821
|
-
return MSafeEnv3;
|
|
822
|
-
})(MSafeEnv || {});
|
|
823
|
-
var UNIT_DATABASE_CONFIG = {
|
|
824
|
-
type: "sqlite",
|
|
825
|
-
database: ":memory:",
|
|
826
|
-
logging: false
|
|
827
|
-
};
|
|
828
|
-
var LOCAL_DATABASE_CONFIG = {
|
|
829
|
-
type: "mysql",
|
|
830
|
-
host: "127.0.0.1",
|
|
831
|
-
port: 3306,
|
|
832
|
-
username: "msafe",
|
|
833
|
-
password: "msafe",
|
|
834
|
-
database: "msafe_sui_local",
|
|
835
|
-
logging: false
|
|
836
|
-
};
|
|
837
|
-
var DEV_DATABASE_CONFIG = {
|
|
838
|
-
type: "mysql",
|
|
839
|
-
host: "msafe-dev-database.cluster-caos3ssocrx6.us-west-1.rds.amazonaws.com",
|
|
840
|
-
port: 3306,
|
|
841
|
-
username: "msafe",
|
|
842
|
-
password: "Momentum.Safe2022",
|
|
843
|
-
database: "msafe_sui_dev",
|
|
844
|
-
logging: false
|
|
845
|
-
};
|
|
846
|
-
var TESTNET_RPC_URL = "https://sui-testnet.blockvision.org/v1/2Sgk89ivT64MnKdcGzjmyjY2ndD";
|
|
847
|
-
var MAINNET_RPC_URL = "https://sui-mainnet.blockvision.org/v1/2Sgk7NPvqkd7mESYkxF01yX15l7";
|
|
848
|
-
var LOCAL_API_URL = "http://127.0.0.1:3000";
|
|
849
|
-
var LOCAL_SYNCING_URL = "http://127.0.0.1:3001";
|
|
850
|
-
var DEV_API_URL = "http://13.56.226.148";
|
|
851
|
-
var DEV_SYNCING_URL = "http://52.53.228.20";
|
|
852
|
-
var ENV_CONFIGS = /* @__PURE__ */ new Map([
|
|
853
|
-
[
|
|
854
|
-
"unit" /* unit */,
|
|
855
|
-
{
|
|
856
|
-
suiClient: {
|
|
857
|
-
url: TESTNET_RPC_URL
|
|
858
|
-
},
|
|
859
|
-
backend: LOCAL_DATABASE_CONFIG,
|
|
860
|
-
apiURL: LOCAL_API_URL,
|
|
861
|
-
syncingURL: LOCAL_SYNCING_URL
|
|
862
|
-
}
|
|
863
|
-
],
|
|
864
|
-
[
|
|
865
|
-
"local" /* local */,
|
|
866
|
-
{
|
|
867
|
-
suiClient: {
|
|
868
|
-
url: TESTNET_RPC_URL
|
|
869
|
-
},
|
|
870
|
-
backend: LOCAL_DATABASE_CONFIG,
|
|
871
|
-
apiURL: LOCAL_API_URL,
|
|
872
|
-
syncingURL: LOCAL_SYNCING_URL
|
|
873
|
-
}
|
|
874
|
-
],
|
|
875
|
-
[
|
|
876
|
-
"dev" /* dev */,
|
|
877
|
-
{
|
|
878
|
-
suiClient: {
|
|
879
|
-
url: TESTNET_RPC_URL
|
|
880
|
-
},
|
|
881
|
-
backend: DEV_DATABASE_CONFIG,
|
|
882
|
-
apiURL: DEV_API_URL,
|
|
883
|
-
syncingURL: DEV_SYNCING_URL
|
|
884
|
-
}
|
|
885
|
-
]
|
|
886
|
-
]);
|
|
887
|
-
function getMSafeConfig(env, options) {
|
|
888
|
-
const config = ENV_CONFIGS.get(env);
|
|
889
|
-
if (!config) {
|
|
890
|
-
throw new Error("Unknown environment");
|
|
891
|
-
}
|
|
892
|
-
if (options?.suiClient?.url) {
|
|
893
|
-
config.suiClient.url = options.suiClient.url;
|
|
894
|
-
}
|
|
895
|
-
if (options?.backend) {
|
|
896
|
-
config.backend = options.backend;
|
|
897
|
-
}
|
|
898
|
-
return config;
|
|
899
|
-
}
|
|
900
|
-
var AUTH_SIGN_MESSAGE = "Welcome to MSafe";
|
|
901
|
-
|
|
902
986
|
// src/backend/BackendImpl.ts
|
|
903
987
|
var import_axios = __toESM(require("axios"), 1);
|
|
904
988
|
var BackendImpl = class {
|
|
@@ -1025,16 +1109,13 @@ var BackendImpl = class {
|
|
|
1025
1109
|
return res.data;
|
|
1026
1110
|
}
|
|
1027
1111
|
async getFutureIntentions(msafeAddress, paginationOption) {
|
|
1028
|
-
const res = await import_axios.default.get(
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
headers: this.headers()
|
|
1036
|
-
}
|
|
1037
|
-
);
|
|
1112
|
+
const res = await import_axios.default.get(`${this.apiURL}/transaction/intention/${msafeAddress}`, {
|
|
1113
|
+
params: {
|
|
1114
|
+
page: paginationOption?.page,
|
|
1115
|
+
limit: paginationOption?.limit
|
|
1116
|
+
},
|
|
1117
|
+
headers: this.headers()
|
|
1118
|
+
});
|
|
1038
1119
|
if (res.status !== 200 && res.status !== 201) {
|
|
1039
1120
|
throw new Error(`invalid getCurrentSequenceNumber return: ${res}`);
|
|
1040
1121
|
}
|
|
@@ -1171,6 +1252,94 @@ var BackendImpl = class {
|
|
|
1171
1252
|
}
|
|
1172
1253
|
};
|
|
1173
1254
|
|
|
1255
|
+
// src/globals/const.ts
|
|
1256
|
+
var MSafeEnv = /* @__PURE__ */ ((MSafeEnv3) => {
|
|
1257
|
+
MSafeEnv3["local"] = "local";
|
|
1258
|
+
MSafeEnv3["unit"] = "unit";
|
|
1259
|
+
MSafeEnv3["dev"] = "dev";
|
|
1260
|
+
MSafeEnv3["prev"] = "prev";
|
|
1261
|
+
MSafeEnv3["prod"] = "prod";
|
|
1262
|
+
return MSafeEnv3;
|
|
1263
|
+
})(MSafeEnv || {});
|
|
1264
|
+
var UNIT_DATABASE_CONFIG = {
|
|
1265
|
+
type: "sqlite",
|
|
1266
|
+
database: ":memory:",
|
|
1267
|
+
logging: false
|
|
1268
|
+
};
|
|
1269
|
+
var LOCAL_DATABASE_CONFIG = {
|
|
1270
|
+
type: "mysql",
|
|
1271
|
+
host: "127.0.0.1",
|
|
1272
|
+
port: 3306,
|
|
1273
|
+
username: "msafe",
|
|
1274
|
+
password: "msafe",
|
|
1275
|
+
database: "msafe_sui_local",
|
|
1276
|
+
logging: false
|
|
1277
|
+
};
|
|
1278
|
+
var DEV_DATABASE_CONFIG = {
|
|
1279
|
+
type: "mysql",
|
|
1280
|
+
host: "msafe-dev-database.cluster-caos3ssocrx6.us-west-1.rds.amazonaws.com",
|
|
1281
|
+
port: 3306,
|
|
1282
|
+
username: "msafe",
|
|
1283
|
+
password: "Momentum.Safe2022",
|
|
1284
|
+
database: "msafe_sui_dev",
|
|
1285
|
+
logging: false
|
|
1286
|
+
};
|
|
1287
|
+
var TESTNET_RPC_URL = "https://sui-testnet.blockvision.org/v1/2Sgk89ivT64MnKdcGzjmyjY2ndD";
|
|
1288
|
+
var MAINNET_RPC_URL = "https://sui-mainnet.blockvision.org/v1/2Sgk7NPvqkd7mESYkxF01yX15l7";
|
|
1289
|
+
var LOCAL_API_URL = "http://127.0.0.1:3000";
|
|
1290
|
+
var LOCAL_SYNCING_URL = "http://127.0.0.1:3001";
|
|
1291
|
+
var DEV_API_URL = "http://13.56.226.148";
|
|
1292
|
+
var DEV_SYNCING_URL = "http://52.53.228.20";
|
|
1293
|
+
var ENV_CONFIGS = /* @__PURE__ */ new Map([
|
|
1294
|
+
[
|
|
1295
|
+
"unit" /* unit */,
|
|
1296
|
+
{
|
|
1297
|
+
suiClient: {
|
|
1298
|
+
url: TESTNET_RPC_URL
|
|
1299
|
+
},
|
|
1300
|
+
backend: LOCAL_DATABASE_CONFIG,
|
|
1301
|
+
apiURL: LOCAL_API_URL,
|
|
1302
|
+
syncingURL: LOCAL_SYNCING_URL
|
|
1303
|
+
}
|
|
1304
|
+
],
|
|
1305
|
+
[
|
|
1306
|
+
"local" /* local */,
|
|
1307
|
+
{
|
|
1308
|
+
suiClient: {
|
|
1309
|
+
url: TESTNET_RPC_URL
|
|
1310
|
+
},
|
|
1311
|
+
backend: LOCAL_DATABASE_CONFIG,
|
|
1312
|
+
apiURL: LOCAL_API_URL,
|
|
1313
|
+
syncingURL: LOCAL_SYNCING_URL
|
|
1314
|
+
}
|
|
1315
|
+
],
|
|
1316
|
+
[
|
|
1317
|
+
"dev" /* dev */,
|
|
1318
|
+
{
|
|
1319
|
+
suiClient: {
|
|
1320
|
+
url: TESTNET_RPC_URL
|
|
1321
|
+
},
|
|
1322
|
+
backend: DEV_DATABASE_CONFIG,
|
|
1323
|
+
apiURL: DEV_API_URL,
|
|
1324
|
+
syncingURL: DEV_SYNCING_URL
|
|
1325
|
+
}
|
|
1326
|
+
]
|
|
1327
|
+
]);
|
|
1328
|
+
function getMSafeConfig(env, options) {
|
|
1329
|
+
const config = ENV_CONFIGS.get(env);
|
|
1330
|
+
if (!config) {
|
|
1331
|
+
throw new Error("Unknown environment");
|
|
1332
|
+
}
|
|
1333
|
+
if (options?.suiClient?.url) {
|
|
1334
|
+
config.suiClient.url = options.suiClient.url;
|
|
1335
|
+
}
|
|
1336
|
+
if (options?.backend) {
|
|
1337
|
+
config.backend = options.backend;
|
|
1338
|
+
}
|
|
1339
|
+
return config;
|
|
1340
|
+
}
|
|
1341
|
+
var AUTH_SIGN_MESSAGE = "Welcome to MSafe";
|
|
1342
|
+
|
|
1174
1343
|
// src/globals/MSafeGlobals.ts
|
|
1175
1344
|
var MSafeGlobals = class _MSafeGlobals {
|
|
1176
1345
|
backend;
|