@imtbl/sdk 0.20.1 → 0.22.0-alpha.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/blockchain_data.d.ts +56 -50
- package/dist/blockchain_data.js +289 -4
- package/dist/browser/checkout.js +2 -2
- package/dist/checkout_sdk.d.ts +71 -25
- package/dist/checkout_sdk.js +1135 -383
- package/dist/checkout_widgets.js +1 -1
- package/dist/immutablex_client.js +1 -1
- package/dist/index.browser.js +13 -13
- package/dist/index.browser.js.map +1 -1
- package/dist/index.cjs +1162 -4210
- package/dist/index.d.ts +179 -792
- package/dist/index.js +1163 -4208
- package/dist/orderbook.d.ts +36 -22
- package/dist/orderbook.js +21 -18
- package/dist/passport.js +111 -5
- package/package.json +2 -20
- package/dist/erc20.d.ts +0 -296
- package/dist/erc20.js +0 -371
- package/dist/erc721.d.ts +0 -592
- package/dist/erc721.js +0 -1790
- package/dist/erc721_mint_by_id.d.ts +0 -521
- package/dist/erc721_mint_by_id.js +0 -1660
package/dist/orderbook.d.ts
CHANGED
|
@@ -724,8 +724,8 @@ declare namespace Fee$1 {
|
|
|
724
724
|
*/
|
|
725
725
|
enum fee_type {
|
|
726
726
|
ROYALTY = "ROYALTY",
|
|
727
|
-
|
|
728
|
-
|
|
727
|
+
MAKER_ECOSYSTEM = "MAKER_ECOSYSTEM",
|
|
728
|
+
TAKER_ECOSYSTEM = "TAKER_ECOSYSTEM",
|
|
729
729
|
PROTOCOL = "PROTOCOL"
|
|
730
730
|
}
|
|
731
731
|
}
|
|
@@ -818,7 +818,7 @@ type CreateListingRequestBody = {
|
|
|
818
818
|
/**
|
|
819
819
|
* Time after which the Order is considered expired
|
|
820
820
|
*/
|
|
821
|
-
|
|
821
|
+
end_at: string;
|
|
822
822
|
protocol_data: ProtocolData;
|
|
823
823
|
/**
|
|
824
824
|
* A random value added to the create Order request
|
|
@@ -835,12 +835,7 @@ type CreateListingRequestBody = {
|
|
|
835
835
|
/**
|
|
836
836
|
* Time after which Order is considered active
|
|
837
837
|
*/
|
|
838
|
-
|
|
839
|
-
};
|
|
840
|
-
|
|
841
|
-
type FulfillmentDataRequest = {
|
|
842
|
-
order_id: string;
|
|
843
|
-
fees: Array<Fee$1>;
|
|
838
|
+
start_at: string;
|
|
844
839
|
};
|
|
845
840
|
|
|
846
841
|
/**
|
|
@@ -877,11 +872,11 @@ type Order$1 = {
|
|
|
877
872
|
/**
|
|
878
873
|
* Time the Order is created
|
|
879
874
|
*/
|
|
880
|
-
|
|
875
|
+
created_at: string;
|
|
881
876
|
/**
|
|
882
877
|
* Time after which the Order is considered expired
|
|
883
878
|
*/
|
|
884
|
-
|
|
879
|
+
end_at: string;
|
|
885
880
|
/**
|
|
886
881
|
* Global Order identifier
|
|
887
882
|
*/
|
|
@@ -899,19 +894,24 @@ type Order$1 = {
|
|
|
899
894
|
/**
|
|
900
895
|
* Time after which Order is considered active
|
|
901
896
|
*/
|
|
902
|
-
|
|
897
|
+
start_at: string;
|
|
903
898
|
status: OrderStatus;
|
|
904
899
|
/**
|
|
905
900
|
* Time the Order is last updated
|
|
906
901
|
*/
|
|
907
|
-
|
|
902
|
+
updated_at: string;
|
|
908
903
|
};
|
|
909
904
|
|
|
910
|
-
type
|
|
905
|
+
type FulfillableOrder = {
|
|
911
906
|
extra_data: string;
|
|
912
907
|
order: Order$1;
|
|
913
908
|
};
|
|
914
909
|
|
|
910
|
+
type FulfillmentDataRequest = {
|
|
911
|
+
order_id: string;
|
|
912
|
+
fees: Array<Fee$1>;
|
|
913
|
+
};
|
|
914
|
+
|
|
915
915
|
type ListingResult$1 = {
|
|
916
916
|
result: Order$1;
|
|
917
917
|
};
|
|
@@ -997,6 +997,17 @@ type TradeResult$1 = {
|
|
|
997
997
|
result: Trade$1;
|
|
998
998
|
};
|
|
999
999
|
|
|
1000
|
+
type UnfulfillableOrder = {
|
|
1001
|
+
/**
|
|
1002
|
+
* OrderID for the requested but unfulfillable order
|
|
1003
|
+
*/
|
|
1004
|
+
order_id: string;
|
|
1005
|
+
/**
|
|
1006
|
+
* Nullable string containing error reason if the signing is unsuccessful for the order
|
|
1007
|
+
*/
|
|
1008
|
+
reason: string;
|
|
1009
|
+
};
|
|
1010
|
+
|
|
1000
1011
|
declare class OrdersService {
|
|
1001
1012
|
readonly httpRequest: BaseHttpRequest;
|
|
1002
1013
|
constructor(httpRequest: BaseHttpRequest);
|
|
@@ -1074,7 +1085,10 @@ declare class OrdersService {
|
|
|
1074
1085
|
chainName: ChainName;
|
|
1075
1086
|
requestBody: Array<FulfillmentDataRequest>;
|
|
1076
1087
|
}): CancelablePromise<{
|
|
1077
|
-
result:
|
|
1088
|
+
result: {
|
|
1089
|
+
fulfillable_orders: Array<FulfillableOrder>;
|
|
1090
|
+
unfulfillable_orders: Array<UnfulfillableOrder>;
|
|
1091
|
+
};
|
|
1078
1092
|
}>;
|
|
1079
1093
|
/**
|
|
1080
1094
|
* List all trades
|
|
@@ -1092,7 +1106,7 @@ declare class OrdersService {
|
|
|
1092
1106
|
/**
|
|
1093
1107
|
* Trade field to sort by
|
|
1094
1108
|
*/
|
|
1095
|
-
sortBy?: '
|
|
1109
|
+
sortBy?: 'indexed_at';
|
|
1096
1110
|
/**
|
|
1097
1111
|
* Ascending or descending direction for sort
|
|
1098
1112
|
*/
|
|
@@ -1155,8 +1169,8 @@ interface CreateListingParams {
|
|
|
1155
1169
|
type ListListingsParams = Omit<Parameters<typeof OrdersService.prototype.listListings>[0], 'chainName'>;
|
|
1156
1170
|
type ListTradesParams = Omit<Parameters<typeof OrdersService.prototype.listTrades>[0], 'chainName'>;
|
|
1157
1171
|
declare enum FeeType {
|
|
1158
|
-
|
|
1159
|
-
|
|
1172
|
+
MAKER_ECOSYSTEM = "MAKER_ECOSYSTEM",
|
|
1173
|
+
TAKER_ECOSYSTEM = "TAKER_ECOSYSTEM",
|
|
1160
1174
|
PROTOCOL = "PROTOCOL",
|
|
1161
1175
|
ROYALTY = "ROYALTY"
|
|
1162
1176
|
}
|
|
@@ -1216,16 +1230,16 @@ interface Order {
|
|
|
1216
1230
|
id: string;
|
|
1217
1231
|
name: string;
|
|
1218
1232
|
};
|
|
1219
|
-
|
|
1220
|
-
|
|
1233
|
+
createdAt: string;
|
|
1234
|
+
updatedAt: string;
|
|
1221
1235
|
/**
|
|
1222
1236
|
* Time after which the Order is considered active
|
|
1223
1237
|
*/
|
|
1224
|
-
|
|
1238
|
+
startAt: string;
|
|
1225
1239
|
/**
|
|
1226
1240
|
* Time after which the Order is expired
|
|
1227
1241
|
*/
|
|
1228
|
-
|
|
1242
|
+
endAt: string;
|
|
1229
1243
|
protocolData: {
|
|
1230
1244
|
orderType: 'FULL_RESTRICTED';
|
|
1231
1245
|
zoneAddress: string;
|
package/dist/orderbook.js
CHANGED
|
@@ -569,8 +569,8 @@ var Fee;
|
|
|
569
569
|
(function (Fee) {
|
|
570
570
|
(function (fee_type) {
|
|
571
571
|
fee_type["ROYALTY"] = "ROYALTY";
|
|
572
|
-
fee_type["
|
|
573
|
-
fee_type["
|
|
572
|
+
fee_type["MAKER_ECOSYSTEM"] = "MAKER_ECOSYSTEM";
|
|
573
|
+
fee_type["TAKER_ECOSYSTEM"] = "TAKER_ECOSYSTEM";
|
|
574
574
|
fee_type["PROTOCOL"] = "PROTOCOL";
|
|
575
575
|
})(Fee.fee_type || (Fee.fee_type = {}));
|
|
576
576
|
})(Fee || (Fee = {}));
|
|
@@ -603,8 +603,8 @@ var ProtocolData;
|
|
|
603
603
|
|
|
604
604
|
var FeeType;
|
|
605
605
|
(function (FeeType) {
|
|
606
|
-
FeeType["
|
|
607
|
-
FeeType["
|
|
606
|
+
FeeType["MAKER_ECOSYSTEM"] = "MAKER_ECOSYSTEM";
|
|
607
|
+
FeeType["TAKER_ECOSYSTEM"] = "TAKER_ECOSYSTEM";
|
|
608
608
|
FeeType["PROTOCOL"] = "PROTOCOL";
|
|
609
609
|
FeeType["ROYALTY"] = "ROYALTY";
|
|
610
610
|
})(FeeType || (FeeType = {}));
|
|
@@ -661,8 +661,8 @@ function mapFromOpenApiOrder(order) {
|
|
|
661
661
|
type: fee.fee_type,
|
|
662
662
|
})),
|
|
663
663
|
chain: order.chain,
|
|
664
|
-
|
|
665
|
-
|
|
664
|
+
createdAt: order.created_at,
|
|
665
|
+
endAt: order.end_at,
|
|
666
666
|
protocolData: {
|
|
667
667
|
counter: order.protocol_data.counter,
|
|
668
668
|
orderType: order.protocol_data.order_type,
|
|
@@ -672,9 +672,9 @@ function mapFromOpenApiOrder(order) {
|
|
|
672
672
|
},
|
|
673
673
|
salt: order.salt,
|
|
674
674
|
signature: order.signature,
|
|
675
|
-
|
|
675
|
+
startAt: order.start_at,
|
|
676
676
|
status: order.status,
|
|
677
|
-
|
|
677
|
+
updatedAt: order.updated_at,
|
|
678
678
|
};
|
|
679
679
|
}
|
|
680
680
|
function mapFromOpenApiTrade(trade) {
|
|
@@ -877,8 +877,8 @@ function mapImmutableOrderToSeaportOrderComponents(order, counter, zoneAddress)
|
|
|
877
877
|
};
|
|
878
878
|
}),
|
|
879
879
|
counter,
|
|
880
|
-
endTime: Math.round(new Date(order.
|
|
881
|
-
startTime: Math.round(new Date(order.
|
|
880
|
+
endTime: Math.round(new Date(order.end_at).getTime() / 1000).toString(),
|
|
881
|
+
startTime: Math.round(new Date(order.start_at).getTime() / 1000).toString(),
|
|
882
882
|
salt: order.salt,
|
|
883
883
|
offerer: order.account_address,
|
|
884
884
|
zone: zoneAddress,
|
|
@@ -1106,10 +1106,10 @@ class ImmutableApiClient {
|
|
|
1106
1106
|
],
|
|
1107
1107
|
fees: makerFees.map((x) => ({
|
|
1108
1108
|
amount: x.amount,
|
|
1109
|
-
fee_type: FeeType.
|
|
1109
|
+
fee_type: FeeType.MAKER_ECOSYSTEM,
|
|
1110
1110
|
recipient: x.recipient,
|
|
1111
1111
|
})),
|
|
1112
|
-
|
|
1112
|
+
end_at: new Date(parseInt(`${orderComponents.endTime.toString()}000`, 10)).toISOString(),
|
|
1113
1113
|
protocol_data: {
|
|
1114
1114
|
order_type: ProtocolData.order_type.FULL_RESTRICTED,
|
|
1115
1115
|
zone_address: orderComponents.zone,
|
|
@@ -1126,7 +1126,7 @@ class ImmutableApiClient {
|
|
|
1126
1126
|
},
|
|
1127
1127
|
],
|
|
1128
1128
|
signature: orderSignature,
|
|
1129
|
-
|
|
1129
|
+
start_at: new Date(parseInt(`${orderComponents.startTime.toString()}000`, 10)).toISOString(),
|
|
1130
1130
|
},
|
|
1131
1131
|
});
|
|
1132
1132
|
}
|
|
@@ -1319,16 +1319,19 @@ class Orderbook {
|
|
|
1319
1319
|
order_id: listingId,
|
|
1320
1320
|
fees: takerFees.map((fee) => ({
|
|
1321
1321
|
amount: fee.amount,
|
|
1322
|
-
fee_type: FeeType.
|
|
1322
|
+
fee_type: FeeType.TAKER_ECOSYSTEM,
|
|
1323
1323
|
recipient: fee.recipient,
|
|
1324
1324
|
})),
|
|
1325
1325
|
},
|
|
1326
1326
|
]);
|
|
1327
|
-
if (fulfillmentDataRes.result.length
|
|
1328
|
-
throw new Error(
|
|
1327
|
+
if (fulfillmentDataRes.result.unfulfillable_orders?.length > 0) {
|
|
1328
|
+
throw new Error(`Unable to prepare fulfillment date: ${fulfillmentDataRes.result.unfulfillable_orders[0].reason}`);
|
|
1329
1329
|
}
|
|
1330
|
-
|
|
1331
|
-
|
|
1330
|
+
else if (fulfillmentDataRes.result.fulfillable_orders?.length !== 1) {
|
|
1331
|
+
throw new Error('unexpected fulfillable order result length');
|
|
1332
|
+
}
|
|
1333
|
+
const extraData = fulfillmentDataRes.result.fulfillable_orders[0].extra_data;
|
|
1334
|
+
const orderResult = fulfillmentDataRes.result.fulfillable_orders[0].order;
|
|
1332
1335
|
if (orderResult.status !== OrderStatus.ACTIVE) {
|
|
1333
1336
|
throw new Error(`Cannot fulfil order that is not active. Current status: ${orderResult.status}`);
|
|
1334
1337
|
}
|
package/dist/passport.js
CHANGED
|
@@ -178,6 +178,18 @@ const assertParamExists$1 = function (functionName, paramName, paramValue) {
|
|
|
178
178
|
throw new RequiredError$1(paramName, `Required parameter ${paramName} was null or undefined when calling ${functionName}.`);
|
|
179
179
|
}
|
|
180
180
|
};
|
|
181
|
+
/**
|
|
182
|
+
*
|
|
183
|
+
* @export
|
|
184
|
+
*/
|
|
185
|
+
const setApiKeyToObject = async function (object, keyParamName, configuration) {
|
|
186
|
+
if (configuration && configuration.apiKey) {
|
|
187
|
+
const localVarApiKeyValue = typeof configuration.apiKey === 'function'
|
|
188
|
+
? await configuration.apiKey(keyParamName)
|
|
189
|
+
: await configuration.apiKey;
|
|
190
|
+
object[keyParamName] = localVarApiKeyValue;
|
|
191
|
+
}
|
|
192
|
+
};
|
|
181
193
|
/**
|
|
182
194
|
*
|
|
183
195
|
* @export
|
|
@@ -668,6 +680,46 @@ const CollectionsApiAxiosParamCreator = function (configuration) {
|
|
|
668
680
|
options: localVarRequestOptions,
|
|
669
681
|
};
|
|
670
682
|
},
|
|
683
|
+
/**
|
|
684
|
+
* Refresh collection metadata
|
|
685
|
+
* @summary Refresh collection metadata
|
|
686
|
+
* @param {string} contractAddress The address contract
|
|
687
|
+
* @param {string} chainName The name of chain
|
|
688
|
+
* @param {RefreshCollectionMetadataRequest} refreshCollectionMetadataRequest The request body
|
|
689
|
+
* @param {*} [options] Override http request option.
|
|
690
|
+
* @throws {RequiredError}
|
|
691
|
+
*/
|
|
692
|
+
refreshCollectionMetadata: async (contractAddress, chainName, refreshCollectionMetadataRequest, options = {}) => {
|
|
693
|
+
// verify required parameter 'contractAddress' is not null or undefined
|
|
694
|
+
assertParamExists$1('refreshCollectionMetadata', 'contractAddress', contractAddress);
|
|
695
|
+
// verify required parameter 'chainName' is not null or undefined
|
|
696
|
+
assertParamExists$1('refreshCollectionMetadata', 'chainName', chainName);
|
|
697
|
+
// verify required parameter 'refreshCollectionMetadataRequest' is not null or undefined
|
|
698
|
+
assertParamExists$1('refreshCollectionMetadata', 'refreshCollectionMetadataRequest', refreshCollectionMetadataRequest);
|
|
699
|
+
const localVarPath = `/v1/chains/{chain_name}/collections/{contract_address}/refresh-metadata`
|
|
700
|
+
.replace(`{${"contract_address"}}`, encodeURIComponent(String(contractAddress)))
|
|
701
|
+
.replace(`{${"chain_name"}}`, encodeURIComponent(String(chainName)));
|
|
702
|
+
// use dummy base URL string because the URL constructor only accepts absolute URLs.
|
|
703
|
+
const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL$1);
|
|
704
|
+
let baseOptions;
|
|
705
|
+
if (configuration) {
|
|
706
|
+
baseOptions = configuration.baseOptions;
|
|
707
|
+
}
|
|
708
|
+
const localVarRequestOptions = { method: 'POST', ...baseOptions, ...options };
|
|
709
|
+
const localVarHeaderParameter = {};
|
|
710
|
+
const localVarQueryParameter = {};
|
|
711
|
+
// authentication ImmutableApiKey required
|
|
712
|
+
await setApiKeyToObject(localVarHeaderParameter, "X-Immutable-API-Key", configuration);
|
|
713
|
+
localVarHeaderParameter['Content-Type'] = 'application/json';
|
|
714
|
+
setSearchParams$1(localVarUrlObj, localVarQueryParameter);
|
|
715
|
+
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
|
|
716
|
+
localVarRequestOptions.headers = { ...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers };
|
|
717
|
+
localVarRequestOptions.data = serializeDataIfNeeded$1(refreshCollectionMetadataRequest, localVarRequestOptions, configuration);
|
|
718
|
+
return {
|
|
719
|
+
url: toPathString$1(localVarUrlObj),
|
|
720
|
+
options: localVarRequestOptions,
|
|
721
|
+
};
|
|
722
|
+
},
|
|
671
723
|
};
|
|
672
724
|
};
|
|
673
725
|
/**
|
|
@@ -716,6 +768,19 @@ const CollectionsApiFp = function (configuration) {
|
|
|
716
768
|
const localVarAxiosArgs = await localVarAxiosParamCreator.listCollectionsByNFTOwner(accountAddress, chainName, pageCursor, pageSize, options);
|
|
717
769
|
return createRequestFunction$1(localVarAxiosArgs, globalAxios$1, BASE_PATH$1, configuration);
|
|
718
770
|
},
|
|
771
|
+
/**
|
|
772
|
+
* Refresh collection metadata
|
|
773
|
+
* @summary Refresh collection metadata
|
|
774
|
+
* @param {string} contractAddress The address contract
|
|
775
|
+
* @param {string} chainName The name of chain
|
|
776
|
+
* @param {RefreshCollectionMetadataRequest} refreshCollectionMetadataRequest The request body
|
|
777
|
+
* @param {*} [options] Override http request option.
|
|
778
|
+
* @throws {RequiredError}
|
|
779
|
+
*/
|
|
780
|
+
async refreshCollectionMetadata(contractAddress, chainName, refreshCollectionMetadataRequest, options) {
|
|
781
|
+
const localVarAxiosArgs = await localVarAxiosParamCreator.refreshCollectionMetadata(contractAddress, chainName, refreshCollectionMetadataRequest, options);
|
|
782
|
+
return createRequestFunction$1(localVarAxiosArgs, globalAxios$1, BASE_PATH$1, configuration);
|
|
783
|
+
},
|
|
719
784
|
};
|
|
720
785
|
};
|
|
721
786
|
/**
|
|
@@ -758,6 +823,17 @@ class CollectionsApi extends BaseAPI$1 {
|
|
|
758
823
|
listCollectionsByNFTOwner(requestParameters, options) {
|
|
759
824
|
return CollectionsApiFp(this.configuration).listCollectionsByNFTOwner(requestParameters.accountAddress, requestParameters.chainName, requestParameters.pageCursor, requestParameters.pageSize, options).then((request) => request(this.axios, this.basePath));
|
|
760
825
|
}
|
|
826
|
+
/**
|
|
827
|
+
* Refresh collection metadata
|
|
828
|
+
* @summary Refresh collection metadata
|
|
829
|
+
* @param {CollectionsApiRefreshCollectionMetadataRequest} requestParameters Request parameters.
|
|
830
|
+
* @param {*} [options] Override http request option.
|
|
831
|
+
* @throws {RequiredError}
|
|
832
|
+
* @memberof CollectionsApi
|
|
833
|
+
*/
|
|
834
|
+
refreshCollectionMetadata(requestParameters, options) {
|
|
835
|
+
return CollectionsApiFp(this.configuration).refreshCollectionMetadata(requestParameters.contractAddress, requestParameters.chainName, requestParameters.refreshCollectionMetadataRequest, options).then((request) => request(this.axios, this.basePath));
|
|
836
|
+
}
|
|
761
837
|
}
|
|
762
838
|
|
|
763
839
|
/* tslint:disable */
|
|
@@ -1327,7 +1403,7 @@ const OrdersApiAxiosParamCreator = function (configuration) {
|
|
|
1327
1403
|
* @param {string} chainName
|
|
1328
1404
|
* @param {string} [accountAddress]
|
|
1329
1405
|
* @param {number} [pageSize] Maximum number of trades to return per page
|
|
1330
|
-
* @param {'
|
|
1406
|
+
* @param {'indexed_at'} [sortBy] Trade field to sort by
|
|
1331
1407
|
* @param {'asc' | 'desc'} [sortDirection] Ascending or descending direction for sort
|
|
1332
1408
|
* @param {string} [pageCursor] Page cursor to retrieve previous or next page. Use the value returned in the response.
|
|
1333
1409
|
* @param {*} [options] Override http request option.
|
|
@@ -1452,7 +1528,7 @@ const OrdersApiFp = function (configuration) {
|
|
|
1452
1528
|
* @param {string} chainName
|
|
1453
1529
|
* @param {string} [accountAddress]
|
|
1454
1530
|
* @param {number} [pageSize] Maximum number of trades to return per page
|
|
1455
|
-
* @param {'
|
|
1531
|
+
* @param {'indexed_at'} [sortBy] Trade field to sort by
|
|
1456
1532
|
* @param {'asc' | 'desc'} [sortDirection] Ascending or descending direction for sort
|
|
1457
1533
|
* @param {string} [pageCursor] Page cursor to retrieve previous or next page. Use the value returned in the response.
|
|
1458
1534
|
* @param {*} [options] Override http request option.
|
|
@@ -1709,7 +1785,7 @@ class MultiRollupApiClients {
|
|
|
1709
1785
|
}
|
|
1710
1786
|
|
|
1711
1787
|
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
1712
|
-
const defaultHeaders = { 'x-sdk-version': 'ts-immutable-sdk-0.
|
|
1788
|
+
const defaultHeaders = { 'x-sdk-version': 'ts-immutable-sdk-0.22.0-alpha.1' };
|
|
1713
1789
|
const createConfig = ({ basePath, headers, }) => {
|
|
1714
1790
|
if (!basePath.trim()) {
|
|
1715
1791
|
throw Error('basePath can not be empty');
|
|
@@ -1765,7 +1841,7 @@ const createImmutableXConfiguration = ({ basePath, chainID, coreContractAddress,
|
|
|
1765
1841
|
chainID,
|
|
1766
1842
|
coreContractAddress,
|
|
1767
1843
|
registrationContractAddress,
|
|
1768
|
-
sdkVersion: 'ts-immutable-sdk-0.
|
|
1844
|
+
sdkVersion: 'ts-immutable-sdk-0.22.0-alpha.1',
|
|
1769
1845
|
});
|
|
1770
1846
|
/**
|
|
1771
1847
|
* Sets `sdkVersion` at the time of build
|
|
@@ -7506,6 +7582,7 @@ var ReceiveMessage;
|
|
|
7506
7582
|
ReceiveMessage["TRANSACTION_ERROR"] = "transaction_error";
|
|
7507
7583
|
ReceiveMessage["MESSAGE_CONFIRMED"] = "message_confirmed";
|
|
7508
7584
|
ReceiveMessage["MESSAGE_REJECTED"] = "message_rejected";
|
|
7585
|
+
ReceiveMessage["LOGOUT_SUCCESS"] = "logout_success";
|
|
7509
7586
|
})(ReceiveMessage || (ReceiveMessage = {}));
|
|
7510
7587
|
const PASSPORT_EVENT_TYPE = 'imx_passport_confirmation';
|
|
7511
7588
|
|
|
@@ -7530,6 +7607,8 @@ const CONFIRMATION_WINDOW_TITLE = 'Confirm this transaction';
|
|
|
7530
7607
|
const CONFIRMATION_WINDOW_HEIGHT = 380;
|
|
7531
7608
|
const CONFIRMATION_WINDOW_WIDTH = 480;
|
|
7532
7609
|
const CONFIRMATION_WINDOW_CLOSED_POLLING_DURATION = 1000;
|
|
7610
|
+
const CONFIRMATION_IFRAME_ID = 'passport-confirm';
|
|
7611
|
+
const CONFIRMATION_IFRAME_STYLE = 'display: none; position: absolute;width:0px;height:0px;border:0;';
|
|
7533
7612
|
class ConfirmationScreen {
|
|
7534
7613
|
config;
|
|
7535
7614
|
confirmationWindow;
|
|
@@ -7623,6 +7702,28 @@ class ConfirmationScreen {
|
|
|
7623
7702
|
closeWindow() {
|
|
7624
7703
|
this.confirmationWindow?.close();
|
|
7625
7704
|
}
|
|
7705
|
+
logout() {
|
|
7706
|
+
return new Promise((resolve, rejects) => {
|
|
7707
|
+
const iframe = document.createElement('iframe');
|
|
7708
|
+
iframe.setAttribute('id', CONFIRMATION_IFRAME_ID);
|
|
7709
|
+
iframe.setAttribute('src', `${this.config.passportDomain}/transaction-confirmation/logout`);
|
|
7710
|
+
iframe.setAttribute('style', CONFIRMATION_IFRAME_STYLE);
|
|
7711
|
+
const logoutHandler = ({ data, origin }) => {
|
|
7712
|
+
if (origin !== this.config.passportDomain
|
|
7713
|
+
|| data.eventType !== PASSPORT_EVENT_TYPE) {
|
|
7714
|
+
return;
|
|
7715
|
+
}
|
|
7716
|
+
window.removeEventListener('message', logoutHandler);
|
|
7717
|
+
iframe.remove();
|
|
7718
|
+
if (data.messageType === ReceiveMessage.LOGOUT_SUCCESS) {
|
|
7719
|
+
resolve({ logout: true });
|
|
7720
|
+
}
|
|
7721
|
+
rejects(new Error('Unsupported logout type'));
|
|
7722
|
+
};
|
|
7723
|
+
window.addEventListener('message', logoutHandler);
|
|
7724
|
+
document.body.appendChild(iframe);
|
|
7725
|
+
});
|
|
7726
|
+
}
|
|
7626
7727
|
showConfirmationScreen(href, messageHandler, resolve) {
|
|
7627
7728
|
this.confirmationWindow.location.href = href;
|
|
7628
7729
|
// https://stackoverflow.com/questions/9388380/capture-the-close-event-of-popup-window-in-javascript/48240128#48240128
|
|
@@ -7968,7 +8069,11 @@ const sendTransaction = ({ params, magicProvider, jsonRpcProvider, relayerClient
|
|
|
7968
8069
|
RelayerTransactionStatus.SUBMITTED,
|
|
7969
8070
|
RelayerTransactionStatus.SUCCESSFUL,
|
|
7970
8071
|
].includes(relayerTransaction.status)) {
|
|
7971
|
-
|
|
8072
|
+
let errorMessage = `Transaction failed to submit with status ${relayerTransaction.status}.`;
|
|
8073
|
+
if (relayerTransaction.statusMessage) {
|
|
8074
|
+
errorMessage += ` Error message: ${relayerTransaction.statusMessage}`;
|
|
8075
|
+
}
|
|
8076
|
+
throw new JsonRpcError(RpcErrorCode.RPC_SERVER_ERROR, errorMessage);
|
|
7972
8077
|
}
|
|
7973
8078
|
return relayerTransaction.hash;
|
|
7974
8079
|
});
|
|
@@ -8318,6 +8423,7 @@ class Passport {
|
|
|
8318
8423
|
}
|
|
8319
8424
|
async logout() {
|
|
8320
8425
|
await this.authManager.logout();
|
|
8426
|
+
await this.confirmationScreen.logout();
|
|
8321
8427
|
// Code after this point is only executed if the logout mode is silent
|
|
8322
8428
|
await this.magicAdapter.logout();
|
|
8323
8429
|
this.passportEventEmitter.emit(PassportEvents.LOGGED_OUT);
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@imtbl/sdk",
|
|
3
3
|
"description": "Immutable Unified SDK",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.22.0-alpha.1",
|
|
5
5
|
"author": "Immutable",
|
|
6
6
|
"browser": "./dist/index.browser.js",
|
|
7
7
|
"bugs": "https://github.com/immutable/ts-immutable-sdk/issues",
|
|
@@ -10,8 +10,6 @@
|
|
|
10
10
|
"@0xsequence/config": "^0.43.34",
|
|
11
11
|
"@ethersproject/abi": "^5.7.0",
|
|
12
12
|
"@ethersproject/abstract-signer": "^5.7.0",
|
|
13
|
-
"@ethersproject/bignumber": "^5.7.0",
|
|
14
|
-
"@ethersproject/contracts": "^5.7.0",
|
|
15
13
|
"@ethersproject/providers": "^5.7.2",
|
|
16
14
|
"@ethersproject/wallet": "^5.7.0",
|
|
17
15
|
"@imtbl/core-sdk": "^2.0.2",
|
|
@@ -27,8 +25,7 @@
|
|
|
27
25
|
"enc-utils": "^3.0.0",
|
|
28
26
|
"ethers": "^5.7.2",
|
|
29
27
|
"magic-sdk": "^13.3.1",
|
|
30
|
-
"oidc-client-ts": "^2.2.1"
|
|
31
|
-
"typechain": "^8.1.1"
|
|
28
|
+
"oidc-client-ts": "^2.2.1"
|
|
32
29
|
},
|
|
33
30
|
"devDependencies": {
|
|
34
31
|
"@imtbl/blockchain-data": "0.0.0",
|
|
@@ -36,9 +33,6 @@
|
|
|
36
33
|
"@imtbl/checkout-widgets": "0.0.0",
|
|
37
34
|
"@imtbl/config": "0.0.0",
|
|
38
35
|
"@imtbl/cryptofiat": "0.0.0",
|
|
39
|
-
"@imtbl/erc20": "0.0.0",
|
|
40
|
-
"@imtbl/erc721": "0.0.0",
|
|
41
|
-
"@imtbl/erc721-mint-by-id": "0.0.0",
|
|
42
36
|
"@imtbl/generated-clients": "0.0.0",
|
|
43
37
|
"@imtbl/guardian": "0.0.0",
|
|
44
38
|
"@imtbl/immutablex-client": "0.0.0",
|
|
@@ -103,18 +97,6 @@
|
|
|
103
97
|
"./checkout_widgets": {
|
|
104
98
|
"types": "./dist/checkout_widgets.d.ts",
|
|
105
99
|
"import": "./dist/checkout_widgets.js"
|
|
106
|
-
},
|
|
107
|
-
"./erc20": {
|
|
108
|
-
"types": "./dist/erc20.d.ts",
|
|
109
|
-
"import": "./dist/erc20.js"
|
|
110
|
-
},
|
|
111
|
-
"./erc721": {
|
|
112
|
-
"types": "./dist/erc721.d.ts",
|
|
113
|
-
"import": "./dist/erc721.js"
|
|
114
|
-
},
|
|
115
|
-
"./erc721_mint_by_id": {
|
|
116
|
-
"types": "./dist/erc721_mint_by_id.d.ts",
|
|
117
|
-
"import": "./dist/erc721_mint_by_id.js"
|
|
118
100
|
}
|
|
119
101
|
},
|
|
120
102
|
"files": [
|