@deriverse/kit 1.0.18 → 1.0.19
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.js +13 -12
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -642,7 +642,7 @@ class Engine {
|
|
|
642
642
|
commitment: this.commitment,
|
|
643
643
|
encoding: 'base64'
|
|
644
644
|
}).send();
|
|
645
|
-
if (infos == null) {
|
|
645
|
+
if (infos.value == null) {
|
|
646
646
|
throw new Error("Initialization failed: getMultipleAccountsInfo");
|
|
647
647
|
}
|
|
648
648
|
this.rootStateModel = structure_models_1.RootStateModel.fromBuffer(infos.value[0].data);
|
|
@@ -682,7 +682,7 @@ class Engine {
|
|
|
682
682
|
addToken(tokenAccount) {
|
|
683
683
|
return __awaiter(this, void 0, void 0, function* () {
|
|
684
684
|
const info = yield this.rpc.getAccountInfo(tokenAccount, { commitment: this.commitment, encoding: 'base64' }).send();
|
|
685
|
-
if (info == null) {
|
|
685
|
+
if (info.value == null) {
|
|
686
686
|
throw new Error("Add Token Failed: getAccountInfo");
|
|
687
687
|
}
|
|
688
688
|
const tokenStateModel = structure_models_1.TokenStateModel.fromBuffer(info.value.data);
|
|
@@ -697,7 +697,7 @@ class Engine {
|
|
|
697
697
|
addInstr(instrAccount) {
|
|
698
698
|
return __awaiter(this, void 0, void 0, function* () {
|
|
699
699
|
const info = yield this.rpc.getAccountInfo(instrAccount, { commitment: this.commitment, encoding: 'base64' }).send();
|
|
700
|
-
if (info == null) {
|
|
700
|
+
if (info.value == null) {
|
|
701
701
|
throw new Error("Add Instrument Failed: getAccountInfo");
|
|
702
702
|
}
|
|
703
703
|
const instrAccountHeaderModel = structure_models_1.InstrAccountHeaderModel.fromBuffer(info.value.data);
|
|
@@ -736,7 +736,7 @@ class Engine {
|
|
|
736
736
|
updateCommunity() {
|
|
737
737
|
return __awaiter(this, void 0, void 0, function* () {
|
|
738
738
|
const info = yield this.rpc.getAccountInfo(this.communityAccount, { commitment: this.commitment, encoding: 'base64' }).send();
|
|
739
|
-
if (info == null) {
|
|
739
|
+
if (info.value == null) {
|
|
740
740
|
throw new Error("Community Account: GetAccountInfo Failed");
|
|
741
741
|
}
|
|
742
742
|
this.updateCommunityFromBuffer(info.value.data);
|
|
@@ -748,7 +748,7 @@ class Engine {
|
|
|
748
748
|
updateRoot() {
|
|
749
749
|
return __awaiter(this, void 0, void 0, function* () {
|
|
750
750
|
const info = yield this.rpc.getAccountInfo(this.rootAccount, { commitment: this.commitment, encoding: 'base64' }).send();
|
|
751
|
-
if (info == null) {
|
|
751
|
+
if (info.value == null) {
|
|
752
752
|
throw new Error("Root Account: GetAccountInfo Failed");
|
|
753
753
|
}
|
|
754
754
|
this.updateRootFromBuffer(info.value.data);
|
|
@@ -1077,7 +1077,7 @@ class Engine {
|
|
|
1077
1077
|
tag: types_1.AccountType.INSTR
|
|
1078
1078
|
});
|
|
1079
1079
|
let info = yield this.rpc.getAccountInfo(instrAddress, { commitment: this.commitment, encoding: 'base64', dataSlice: { offset: structure_models_1.InstrAccountHeaderModel.OFFSET_ID, length: 4 } }).send();
|
|
1080
|
-
if (info == null) {
|
|
1080
|
+
if (info.value == null) {
|
|
1081
1081
|
return null;
|
|
1082
1082
|
}
|
|
1083
1083
|
else {
|
|
@@ -1187,7 +1187,7 @@ class Engine {
|
|
|
1187
1187
|
commitment: this.commitment,
|
|
1188
1188
|
encoding: 'base64'
|
|
1189
1189
|
}).send();
|
|
1190
|
-
if (info == null) {
|
|
1190
|
+
if (info.value == null) {
|
|
1191
1191
|
return false;
|
|
1192
1192
|
}
|
|
1193
1193
|
const clientPrimaryAccountHeaderModel = structure_models_1.ClientPrimaryAccountHeaderModel.fromBuffer(info.value.data);
|
|
@@ -1215,7 +1215,7 @@ class Engine {
|
|
|
1215
1215
|
commitment: this.commitment,
|
|
1216
1216
|
encoding: 'base64'
|
|
1217
1217
|
}).send();
|
|
1218
|
-
if (infos == null) {
|
|
1218
|
+
if (infos.value == null) {
|
|
1219
1219
|
throw new Error("GetClientData: GetAccountInfo failed");
|
|
1220
1220
|
}
|
|
1221
1221
|
const clientPrimaryAccountHeaderModel = structure_models_1.ClientPrimaryAccountHeaderModel.fromBuffer(infos.value[0].data);
|
|
@@ -2548,8 +2548,8 @@ class Engine {
|
|
|
2548
2548
|
const tokenProgramId = assetInfo.value.owner == TOKEN_2022_PROGRAM_ID ? TOKEN_2022_PROGRAM_ID : TOKEN_PROGRAM_ID;
|
|
2549
2549
|
const crncyTokenId = yield this.getTokenId(args.crncyMint);
|
|
2550
2550
|
const id = yield this.getTokenId(args.assetMint);
|
|
2551
|
-
const
|
|
2552
|
-
const assetTokenId =
|
|
2551
|
+
const newAssetToken = id == null;
|
|
2552
|
+
const assetTokenId = newAssetToken ? this.rootStateModel.tokensCount : id;
|
|
2553
2553
|
if (!crncyTokenId) {
|
|
2554
2554
|
throw new Error("Currency mint not found");
|
|
2555
2555
|
}
|
|
@@ -2579,11 +2579,12 @@ class Engine {
|
|
|
2579
2579
|
let keys = [
|
|
2580
2580
|
{ address: this.signer, role: kit_1.AccountRole.READONLY_SIGNER },
|
|
2581
2581
|
{ address: this.rootAccount, role: kit_1.AccountRole.WRITABLE },
|
|
2582
|
-
{ address: yield this.getTokenAccount(args.assetMint), role:
|
|
2582
|
+
{ address: yield this.getTokenAccount(args.assetMint), role: newAssetToken ? kit_1.AccountRole.WRITABLE : kit_1.AccountRole.READONLY },
|
|
2583
2583
|
{ address: yield this.getTokenAccount(args.crncyMint), role: kit_1.AccountRole.READONLY },
|
|
2584
|
-
{ address:
|
|
2584
|
+
{ address: newAssetToken ? args.newProgramAccountAddress : this.tokens.get(assetTokenId).programAddress, role: newAssetToken ? kit_1.AccountRole.WRITABLE_SIGNER : kit_1.AccountRole.READONLY },
|
|
2585
2585
|
{ address: args.assetMint, role: kit_1.AccountRole.READONLY },
|
|
2586
2586
|
{ address: lutAddress, role: kit_1.AccountRole.WRITABLE },
|
|
2587
|
+
{ address: SYSTEM_PROGRAM_ID, role: kit_1.AccountRole.READONLY },
|
|
2587
2588
|
{ address: tokenProgramId, role: kit_1.AccountRole.READONLY },
|
|
2588
2589
|
{ address: ADDRESS_LOOKUP_TABLE_PROGRAM_ID, role: kit_1.AccountRole.READONLY },
|
|
2589
2590
|
{ address: this.drvsAuthority, role: kit_1.AccountRole.READONLY },
|