@startbahn/startrail-sdk-js 1.29.0 → 1.29.1
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/startrail-sdk.js +18 -83
- package/package.json +1 -1
- package/types/startrail-sdk-js.d.ts +0 -26
package/dist/startrail-sdk.js
CHANGED
|
@@ -169471,41 +169471,6 @@ class Service {
|
|
|
169471
169471
|
return this.tx.sendRequest('put', '/srr/metadata/convert', { body: args });
|
|
169472
169472
|
});
|
|
169473
169473
|
}
|
|
169474
|
-
/**
|
|
169475
|
-
* Creates and sends a batch of SRRs to be issued providing the same SRRs as /bulk/typedData to prove the same merkle root
|
|
169476
|
-
* @throws Will throw an error
|
|
169477
|
-
* @deprecated
|
|
169478
|
-
*/
|
|
169479
|
-
createAndSRRBatch(args) {
|
|
169480
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
169481
|
-
this._validateEoaMatchFromInitialLogin();
|
|
169482
|
-
args.srrs.map((e, i) => {
|
|
169483
|
-
args.srrs[i].lockExternalTransfer = e.lockExternalTransfer || false;
|
|
169484
|
-
});
|
|
169485
|
-
const req = util_1.buildRequestObject(args);
|
|
169486
|
-
const reqBody = args.useCompress !== false ? util_1.compressJsonToBuffer(req.body) : req.body;
|
|
169487
|
-
const typedDataReqBody = args.useCompress !== false ? util_1.compressJsonToBuffer(typedDataProps(req)) : typedDataProps(req);
|
|
169488
|
-
return this._handleTypedSignatureAndMainApiRequest(Object.assign(Object.assign({}, req), { body: reqBody, typedDataBody: typedDataReqBody }), httpRequestInfo('/srr/bulk/issue', 'post'));
|
|
169489
|
-
});
|
|
169490
|
-
}
|
|
169491
|
-
/**
|
|
169492
|
-
* Creates and sends a batch of SRRs to be approved and transferred
|
|
169493
|
-
* providing the same data as corresponding typedData to prove the same merkle root
|
|
169494
|
-
* @throws Will throw an error
|
|
169495
|
-
* @deprecated
|
|
169496
|
-
*/
|
|
169497
|
-
createAndSendSRRTransferBatch(args) {
|
|
169498
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
169499
|
-
this._validateEoaMatchFromInitialLogin();
|
|
169500
|
-
const req = util_1.buildRequestObject(args);
|
|
169501
|
-
req.body = {
|
|
169502
|
-
txs: args.txs.map(e => {
|
|
169503
|
-
return Object.assign({ tokenId: e.tokenId }, buildHashingPreimage(e));
|
|
169504
|
-
})
|
|
169505
|
-
};
|
|
169506
|
-
return this._handleTypedSignatureAndMainApiRequest(req, httpRequestInfo('/srr/bulk/transfer', 'post'));
|
|
169507
|
-
});
|
|
169508
|
-
}
|
|
169509
169474
|
/**
|
|
169510
169475
|
* Send approval for SRR ownership transfer to the next owner
|
|
169511
169476
|
* @throws Will throw an error
|
|
@@ -169514,8 +169479,7 @@ class Service {
|
|
|
169514
169479
|
return __awaiter(this, void 0, void 0, function* () {
|
|
169515
169480
|
this._validateEoaMatchFromInitialLogin();
|
|
169516
169481
|
const req = util_1.buildRequestObject(args);
|
|
169517
|
-
req
|
|
169518
|
-
return this._handleTypedSignatureAndMainApiRequest(req, httpRequestInfo(`/srr/${req.tokenId}/approveByCommitment`, 'put'));
|
|
169482
|
+
return this._handleTypedSignatureAndMainApiRequest(Object.assign(Object.assign({}, req), { body: buildHashingPreimage(args) }), httpRequestInfo(`/srr/${req.tokenId}/approveByCommitment`, 'put'));
|
|
169519
169483
|
});
|
|
169520
169484
|
}
|
|
169521
169485
|
/**
|
|
@@ -169527,8 +169491,9 @@ class Service {
|
|
|
169527
169491
|
return __awaiter(this, void 0, void 0, function* () {
|
|
169528
169492
|
this._validateEoaMatchFromInitialLogin();
|
|
169529
169493
|
const req = util_1.buildRequestObject(args);
|
|
169530
|
-
|
|
169531
|
-
|
|
169494
|
+
const typedData = yield this.tx.sendRequest('put', `/srr/${req.tokenId}/approveByCommitment/typedData`, {
|
|
169495
|
+
body: typedDataProps(Object.assign(Object.assign({}, req), { body: buildHashingPreimage(args) }))
|
|
169496
|
+
});
|
|
169532
169497
|
const signature = yield this.wallet.signTypedDataMessage(typedData);
|
|
169533
169498
|
return Object.assign({ signature }, util_1.convertToUnpackNonce(typedData.message.nonce));
|
|
169534
169499
|
});
|
|
@@ -169554,11 +169519,19 @@ class Service {
|
|
|
169554
169519
|
bulk(args) {
|
|
169555
169520
|
return __awaiter(this, void 0, void 0, function* () {
|
|
169556
169521
|
this._validateEoaMatchFromInitialLogin();
|
|
169557
|
-
// Todo:
|
|
169558
|
-
const
|
|
169559
|
-
|
|
169560
|
-
const
|
|
169561
|
-
|
|
169522
|
+
// Todo: Refine types later
|
|
169523
|
+
const formattedReq = util_1.buildRequestObject(util_1.convertEthereumAddressToChecksum(args));
|
|
169524
|
+
// To apply ApproveSRRByCommitmentShared type
|
|
169525
|
+
const getIsApproveSRRByCommitment = (tx) => {
|
|
169526
|
+
return tx.functionType === 'approveSRRByCommitment';
|
|
169527
|
+
};
|
|
169528
|
+
const req = Object.assign(Object.assign({}, formattedReq), { body: {
|
|
169529
|
+
txs: formattedReq.body.txs.map((tx) => {
|
|
169530
|
+
return getIsApproveSRRByCommitment(tx)
|
|
169531
|
+
? Object.assign(Object.assign({}, tx), { data: Object.assign(Object.assign({}, buildHashingPreimage(tx.data)), { tokenId: tx.data.tokenId }) }) : tx;
|
|
169532
|
+
})
|
|
169533
|
+
} });
|
|
169534
|
+
return this._handleTypedSignatureAndMainApiRequest(Object.assign(Object.assign({}, formattedReq), { body: args.isCompressEnabled ? util_1.compressJsonToBuffer(req.body) : req.body, typedDataBody: args.isCompressEnabled ? util_1.compressJsonToBuffer(typedDataProps(req)) : typedDataProps(req) }), httpRequestInfo('/srr/bulk', 'post'));
|
|
169562
169535
|
});
|
|
169563
169536
|
}
|
|
169564
169537
|
/**
|
|
@@ -169743,45 +169716,6 @@ class Startrail {
|
|
|
169743
169716
|
return yield this.service.convertMetadata(args);
|
|
169744
169717
|
});
|
|
169745
169718
|
}
|
|
169746
|
-
/**
|
|
169747
|
-
* Creates and sends a batch of SRRs to be issued
|
|
169748
|
-
* @throws Will throw an error
|
|
169749
|
-
* @deprecated
|
|
169750
|
-
*/
|
|
169751
|
-
createAndSRRBatch(args) {
|
|
169752
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
169753
|
-
if (this.store.torusStatus.popupInprogress)
|
|
169754
|
-
return false;
|
|
169755
|
-
this.store.switchPopupState();
|
|
169756
|
-
try {
|
|
169757
|
-
yield this.service.login();
|
|
169758
|
-
return yield this.service.createAndSRRBatch(args);
|
|
169759
|
-
}
|
|
169760
|
-
finally {
|
|
169761
|
-
this.store.switchPopupState();
|
|
169762
|
-
}
|
|
169763
|
-
});
|
|
169764
|
-
}
|
|
169765
|
-
/**
|
|
169766
|
-
* Creates and sends a batch of SRRs to be approved and transferred
|
|
169767
|
-
* providing the same data as corresponding typedData to prove the same merkle root
|
|
169768
|
-
* @throws Will throw an error
|
|
169769
|
-
* @deprecated
|
|
169770
|
-
*/
|
|
169771
|
-
createAndSendSRRTransferBatch(args) {
|
|
169772
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
169773
|
-
if (this.store.torusStatus.popupInprogress)
|
|
169774
|
-
return false;
|
|
169775
|
-
this.store.switchPopupState();
|
|
169776
|
-
try {
|
|
169777
|
-
yield this.service.login();
|
|
169778
|
-
return yield this.service.createAndSendSRRTransferBatch(args);
|
|
169779
|
-
}
|
|
169780
|
-
finally {
|
|
169781
|
-
this.store.switchPopupState();
|
|
169782
|
-
}
|
|
169783
|
-
});
|
|
169784
|
-
}
|
|
169785
169719
|
/**
|
|
169786
169720
|
* Send approval for SRR ownership transfer to the next owner
|
|
169787
169721
|
* Note: this action does not complete SRR ownership transfer. New owner MUST call the associated function to complete it
|
|
@@ -170029,6 +169963,7 @@ exports.extractRequestParam = (arg) => {
|
|
|
170029
169963
|
};
|
|
170030
169964
|
/**
|
|
170031
169965
|
* Separate args into body, header and others for http request
|
|
169966
|
+
* TODO: refactor type
|
|
170032
169967
|
*/
|
|
170033
169968
|
exports.buildRequestObject = (arg) => {
|
|
170034
169969
|
const { startrailLUWContractAddress, tokenId, batchId, isHashPreimageEnabled, isCompressEnabled } = arg, requestParam = __rest(arg, ["startrailLUWContractAddress", "tokenId", "batchId", "isHashPreimageEnabled", "isCompressEnabled"]);
|
package/package.json
CHANGED
|
@@ -52,19 +52,6 @@ declare module '@startbahn/startrail-sdk-js' {
|
|
|
52
52
|
* @throws Will throw an error
|
|
53
53
|
*/
|
|
54
54
|
convertMetadata(args: Type.ConvertMetadata): Promise<Type.ResponseOfConvertMetadata[]>;
|
|
55
|
-
/**
|
|
56
|
-
* Creates and sends a batch of SRRs to be issued
|
|
57
|
-
* @throws Will throw an error
|
|
58
|
-
* @deprecated
|
|
59
|
-
*/
|
|
60
|
-
createAndSRRBatch(args: Type.CreateSRRBatch): Promise<Type.ResponseFromBatch | false>;
|
|
61
|
-
/**
|
|
62
|
-
* Creates and sends a batch of SRRs to be approved and transferred
|
|
63
|
-
* providing the same data as corresponding typedData to prove the same merkle root
|
|
64
|
-
* @throws Will throw an error
|
|
65
|
-
* @deprecated
|
|
66
|
-
*/
|
|
67
|
-
createAndSendSRRTransferBatch(args: Type.TransferSRRBatch): Promise<Type.ResponseFromBatch | false>;
|
|
68
55
|
/**
|
|
69
56
|
* Send approval for SRR ownership transfer to the next owner
|
|
70
57
|
* Note: this action does not complete SRR ownership transfer. New owner MUST call the associated function to complete it
|
|
@@ -679,19 +666,6 @@ declare module '@startbahn/startrail-sdk-js/service' {
|
|
|
679
666
|
* @throws Will throw an error
|
|
680
667
|
*/
|
|
681
668
|
convertMetadata(args: Type.ConvertMetadata): Promise<Type.ResponseOfConvertMetadata[]>;
|
|
682
|
-
/**
|
|
683
|
-
* Creates and sends a batch of SRRs to be issued providing the same SRRs as /bulk/typedData to prove the same merkle root
|
|
684
|
-
* @throws Will throw an error
|
|
685
|
-
* @deprecated
|
|
686
|
-
*/
|
|
687
|
-
createAndSRRBatch(args: Type.CreateSRRBatch): Promise<Type.ResponseFromBatch>;
|
|
688
|
-
/**
|
|
689
|
-
* Creates and sends a batch of SRRs to be approved and transferred
|
|
690
|
-
* providing the same data as corresponding typedData to prove the same merkle root
|
|
691
|
-
* @throws Will throw an error
|
|
692
|
-
* @deprecated
|
|
693
|
-
*/
|
|
694
|
-
createAndSendSRRTransferBatch(args: Type.TransferSRRBatch): Promise<Type.ResponseFromBatch>;
|
|
695
669
|
/**
|
|
696
670
|
* Send approval for SRR ownership transfer to the next owner
|
|
697
671
|
* @throws Will throw an error
|