@imtbl/sdk 0.15.2-alpha → 0.16.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.js +252 -33
- package/dist/browser/checkout.js +2 -2
- package/dist/checkout_sdk.d.ts +56 -1
- package/dist/checkout_sdk.js +394 -16
- package/dist/checkout_widgets.d.ts +1 -0
- package/dist/checkout_widgets.js +1 -1
- package/dist/erc721.d.ts +4 -4
- package/dist/erc721.js +57 -69
- package/dist/erc721_mint_by_id.d.ts +4 -4
- package/dist/erc721_mint_by_id.js +51 -51
- package/dist/immutablex_client.js +1 -1
- package/dist/index.browser.js +15 -15
- package/dist/index.browser.js.map +1 -1
- package/dist/index.cjs +789 -175
- package/dist/index.d.ts +225 -16
- package/dist/index.js +789 -175
- package/dist/orderbook.d.ts +150 -4
- package/dist/orderbook.js +135 -0
- package/dist/passport.d.ts +1 -0
- package/dist/passport.js +228 -18
- package/package.json +1 -1
package/dist/passport.js
CHANGED
|
@@ -1098,16 +1098,16 @@ const OrdersApiAxiosParamCreator = function (configuration) {
|
|
|
1098
1098
|
* Retrieve signed fulfillment data based on the list of order IDs and corresponding fees.
|
|
1099
1099
|
* @summary Retrieve fulfillment data for orders
|
|
1100
1100
|
* @param {string} chainName
|
|
1101
|
-
* @param {Array<
|
|
1101
|
+
* @param {Array<FulfillmentDataRequest>} fulfillmentDataRequest
|
|
1102
1102
|
* @param {*} [options] Override http request option.
|
|
1103
1103
|
* @throws {RequiredError}
|
|
1104
1104
|
*/
|
|
1105
|
-
fulfillmentData: async (chainName,
|
|
1105
|
+
fulfillmentData: async (chainName, fulfillmentDataRequest, options = {}) => {
|
|
1106
1106
|
// verify required parameter 'chainName' is not null or undefined
|
|
1107
1107
|
assertParamExists$1('fulfillmentData', 'chainName', chainName);
|
|
1108
|
-
// verify required parameter '
|
|
1109
|
-
assertParamExists$1('fulfillmentData', '
|
|
1110
|
-
const localVarPath = `/v1/chains/{chain_name}/orders/
|
|
1108
|
+
// verify required parameter 'fulfillmentDataRequest' is not null or undefined
|
|
1109
|
+
assertParamExists$1('fulfillmentData', 'fulfillmentDataRequest', fulfillmentDataRequest);
|
|
1110
|
+
const localVarPath = `/v1/chains/{chain_name}/orders/fulfillment-data`
|
|
1111
1111
|
.replace(`{${"chain_name"}}`, encodeURIComponent(String(chainName)));
|
|
1112
1112
|
// use dummy base URL string because the URL constructor only accepts absolute URLs.
|
|
1113
1113
|
const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL$1);
|
|
@@ -1122,7 +1122,7 @@ const OrdersApiAxiosParamCreator = function (configuration) {
|
|
|
1122
1122
|
setSearchParams$1(localVarUrlObj, localVarQueryParameter);
|
|
1123
1123
|
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
|
|
1124
1124
|
localVarRequestOptions.headers = { ...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers };
|
|
1125
|
-
localVarRequestOptions.data = serializeDataIfNeeded$1(
|
|
1125
|
+
localVarRequestOptions.data = serializeDataIfNeeded$1(fulfillmentDataRequest, localVarRequestOptions, configuration);
|
|
1126
1126
|
return {
|
|
1127
1127
|
url: toPathString$1(localVarUrlObj),
|
|
1128
1128
|
options: localVarRequestOptions,
|
|
@@ -1161,6 +1161,39 @@ const OrdersApiAxiosParamCreator = function (configuration) {
|
|
|
1161
1161
|
options: localVarRequestOptions,
|
|
1162
1162
|
};
|
|
1163
1163
|
},
|
|
1164
|
+
/**
|
|
1165
|
+
* Get a single trade by ID
|
|
1166
|
+
* @summary Get a single trade by ID
|
|
1167
|
+
* @param {string} chainName
|
|
1168
|
+
* @param {string} tradeId Global Trade identifier
|
|
1169
|
+
* @param {*} [options] Override http request option.
|
|
1170
|
+
* @throws {RequiredError}
|
|
1171
|
+
*/
|
|
1172
|
+
getTrade: async (chainName, tradeId, options = {}) => {
|
|
1173
|
+
// verify required parameter 'chainName' is not null or undefined
|
|
1174
|
+
assertParamExists$1('getTrade', 'chainName', chainName);
|
|
1175
|
+
// verify required parameter 'tradeId' is not null or undefined
|
|
1176
|
+
assertParamExists$1('getTrade', 'tradeId', tradeId);
|
|
1177
|
+
const localVarPath = `/v1/chains/{chain_name}/trades/{trade_id}`
|
|
1178
|
+
.replace(`{${"chain_name"}}`, encodeURIComponent(String(chainName)))
|
|
1179
|
+
.replace(`{${"trade_id"}}`, encodeURIComponent(String(tradeId)));
|
|
1180
|
+
// use dummy base URL string because the URL constructor only accepts absolute URLs.
|
|
1181
|
+
const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL$1);
|
|
1182
|
+
let baseOptions;
|
|
1183
|
+
if (configuration) {
|
|
1184
|
+
baseOptions = configuration.baseOptions;
|
|
1185
|
+
}
|
|
1186
|
+
const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options };
|
|
1187
|
+
const localVarHeaderParameter = {};
|
|
1188
|
+
const localVarQueryParameter = {};
|
|
1189
|
+
setSearchParams$1(localVarUrlObj, localVarQueryParameter);
|
|
1190
|
+
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
|
|
1191
|
+
localVarRequestOptions.headers = { ...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers };
|
|
1192
|
+
return {
|
|
1193
|
+
url: toPathString$1(localVarUrlObj),
|
|
1194
|
+
options: localVarRequestOptions,
|
|
1195
|
+
};
|
|
1196
|
+
},
|
|
1164
1197
|
/**
|
|
1165
1198
|
* List all listings
|
|
1166
1199
|
* @summary List all listings
|
|
@@ -1222,6 +1255,51 @@ const OrdersApiAxiosParamCreator = function (configuration) {
|
|
|
1222
1255
|
options: localVarRequestOptions,
|
|
1223
1256
|
};
|
|
1224
1257
|
},
|
|
1258
|
+
/**
|
|
1259
|
+
* List all trades
|
|
1260
|
+
* @summary List all trades
|
|
1261
|
+
* @param {string} chainName
|
|
1262
|
+
* @param {number} [pageSize] Maximum number of trades to return per page
|
|
1263
|
+
* @param {'created_at'} [sortBy] Trade field to sort by
|
|
1264
|
+
* @param {'asc' | 'desc'} [sortDirection] Ascending or descending direction for sort
|
|
1265
|
+
* @param {string} [pageCursor] Page cursor to retrieve previous or next page. Use the value returned in the response.
|
|
1266
|
+
* @param {*} [options] Override http request option.
|
|
1267
|
+
* @throws {RequiredError}
|
|
1268
|
+
*/
|
|
1269
|
+
listTrades: async (chainName, pageSize, sortBy, sortDirection, pageCursor, options = {}) => {
|
|
1270
|
+
// verify required parameter 'chainName' is not null or undefined
|
|
1271
|
+
assertParamExists$1('listTrades', 'chainName', chainName);
|
|
1272
|
+
const localVarPath = `/v1/chains/{chain_name}/trades`
|
|
1273
|
+
.replace(`{${"chain_name"}}`, encodeURIComponent(String(chainName)));
|
|
1274
|
+
// use dummy base URL string because the URL constructor only accepts absolute URLs.
|
|
1275
|
+
const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL$1);
|
|
1276
|
+
let baseOptions;
|
|
1277
|
+
if (configuration) {
|
|
1278
|
+
baseOptions = configuration.baseOptions;
|
|
1279
|
+
}
|
|
1280
|
+
const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options };
|
|
1281
|
+
const localVarHeaderParameter = {};
|
|
1282
|
+
const localVarQueryParameter = {};
|
|
1283
|
+
if (pageSize !== undefined) {
|
|
1284
|
+
localVarQueryParameter['page_size'] = pageSize;
|
|
1285
|
+
}
|
|
1286
|
+
if (sortBy !== undefined) {
|
|
1287
|
+
localVarQueryParameter['sort_by'] = sortBy;
|
|
1288
|
+
}
|
|
1289
|
+
if (sortDirection !== undefined) {
|
|
1290
|
+
localVarQueryParameter['sort_direction'] = sortDirection;
|
|
1291
|
+
}
|
|
1292
|
+
if (pageCursor !== undefined) {
|
|
1293
|
+
localVarQueryParameter['page_cursor'] = pageCursor;
|
|
1294
|
+
}
|
|
1295
|
+
setSearchParams$1(localVarUrlObj, localVarQueryParameter);
|
|
1296
|
+
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
|
|
1297
|
+
localVarRequestOptions.headers = { ...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers };
|
|
1298
|
+
return {
|
|
1299
|
+
url: toPathString$1(localVarUrlObj),
|
|
1300
|
+
options: localVarRequestOptions,
|
|
1301
|
+
};
|
|
1302
|
+
},
|
|
1225
1303
|
};
|
|
1226
1304
|
};
|
|
1227
1305
|
/**
|
|
@@ -1247,12 +1325,12 @@ const OrdersApiFp = function (configuration) {
|
|
|
1247
1325
|
* Retrieve signed fulfillment data based on the list of order IDs and corresponding fees.
|
|
1248
1326
|
* @summary Retrieve fulfillment data for orders
|
|
1249
1327
|
* @param {string} chainName
|
|
1250
|
-
* @param {Array<
|
|
1328
|
+
* @param {Array<FulfillmentDataRequest>} fulfillmentDataRequest
|
|
1251
1329
|
* @param {*} [options] Override http request option.
|
|
1252
1330
|
* @throws {RequiredError}
|
|
1253
1331
|
*/
|
|
1254
|
-
async fulfillmentData(chainName,
|
|
1255
|
-
const localVarAxiosArgs = await localVarAxiosParamCreator.fulfillmentData(chainName,
|
|
1332
|
+
async fulfillmentData(chainName, fulfillmentDataRequest, options) {
|
|
1333
|
+
const localVarAxiosArgs = await localVarAxiosParamCreator.fulfillmentData(chainName, fulfillmentDataRequest, options);
|
|
1256
1334
|
return createRequestFunction$1(localVarAxiosArgs, globalAxios$1, BASE_PATH$1, configuration);
|
|
1257
1335
|
},
|
|
1258
1336
|
/**
|
|
@@ -1267,6 +1345,18 @@ const OrdersApiFp = function (configuration) {
|
|
|
1267
1345
|
const localVarAxiosArgs = await localVarAxiosParamCreator.getListing(chainName, listingId, options);
|
|
1268
1346
|
return createRequestFunction$1(localVarAxiosArgs, globalAxios$1, BASE_PATH$1, configuration);
|
|
1269
1347
|
},
|
|
1348
|
+
/**
|
|
1349
|
+
* Get a single trade by ID
|
|
1350
|
+
* @summary Get a single trade by ID
|
|
1351
|
+
* @param {string} chainName
|
|
1352
|
+
* @param {string} tradeId Global Trade identifier
|
|
1353
|
+
* @param {*} [options] Override http request option.
|
|
1354
|
+
* @throws {RequiredError}
|
|
1355
|
+
*/
|
|
1356
|
+
async getTrade(chainName, tradeId, options) {
|
|
1357
|
+
const localVarAxiosArgs = await localVarAxiosParamCreator.getTrade(chainName, tradeId, options);
|
|
1358
|
+
return createRequestFunction$1(localVarAxiosArgs, globalAxios$1, BASE_PATH$1, configuration);
|
|
1359
|
+
},
|
|
1270
1360
|
/**
|
|
1271
1361
|
* List all listings
|
|
1272
1362
|
* @summary List all listings
|
|
@@ -1286,6 +1376,21 @@ const OrdersApiFp = function (configuration) {
|
|
|
1286
1376
|
const localVarAxiosArgs = await localVarAxiosParamCreator.listListings(chainName, status, sellItemContractAddress, buyItemContractAddress, sellItemTokenId, pageSize, sortBy, sortDirection, pageCursor, options);
|
|
1287
1377
|
return createRequestFunction$1(localVarAxiosArgs, globalAxios$1, BASE_PATH$1, configuration);
|
|
1288
1378
|
},
|
|
1379
|
+
/**
|
|
1380
|
+
* List all trades
|
|
1381
|
+
* @summary List all trades
|
|
1382
|
+
* @param {string} chainName
|
|
1383
|
+
* @param {number} [pageSize] Maximum number of trades to return per page
|
|
1384
|
+
* @param {'created_at'} [sortBy] Trade field to sort by
|
|
1385
|
+
* @param {'asc' | 'desc'} [sortDirection] Ascending or descending direction for sort
|
|
1386
|
+
* @param {string} [pageCursor] Page cursor to retrieve previous or next page. Use the value returned in the response.
|
|
1387
|
+
* @param {*} [options] Override http request option.
|
|
1388
|
+
* @throws {RequiredError}
|
|
1389
|
+
*/
|
|
1390
|
+
async listTrades(chainName, pageSize, sortBy, sortDirection, pageCursor, options) {
|
|
1391
|
+
const localVarAxiosArgs = await localVarAxiosParamCreator.listTrades(chainName, pageSize, sortBy, sortDirection, pageCursor, options);
|
|
1392
|
+
return createRequestFunction$1(localVarAxiosArgs, globalAxios$1, BASE_PATH$1, configuration);
|
|
1393
|
+
},
|
|
1289
1394
|
};
|
|
1290
1395
|
};
|
|
1291
1396
|
/**
|
|
@@ -1315,7 +1420,7 @@ class OrdersApi extends BaseAPI$1 {
|
|
|
1315
1420
|
* @memberof OrdersApi
|
|
1316
1421
|
*/
|
|
1317
1422
|
fulfillmentData(requestParameters, options) {
|
|
1318
|
-
return OrdersApiFp(this.configuration).fulfillmentData(requestParameters.chainName, requestParameters.
|
|
1423
|
+
return OrdersApiFp(this.configuration).fulfillmentData(requestParameters.chainName, requestParameters.fulfillmentDataRequest, options).then((request) => request(this.axios, this.basePath));
|
|
1319
1424
|
}
|
|
1320
1425
|
/**
|
|
1321
1426
|
* Get a single listing by ID
|
|
@@ -1328,6 +1433,17 @@ class OrdersApi extends BaseAPI$1 {
|
|
|
1328
1433
|
getListing(requestParameters, options) {
|
|
1329
1434
|
return OrdersApiFp(this.configuration).getListing(requestParameters.chainName, requestParameters.listingId, options).then((request) => request(this.axios, this.basePath));
|
|
1330
1435
|
}
|
|
1436
|
+
/**
|
|
1437
|
+
* Get a single trade by ID
|
|
1438
|
+
* @summary Get a single trade by ID
|
|
1439
|
+
* @param {OrdersApiGetTradeRequest} requestParameters Request parameters.
|
|
1440
|
+
* @param {*} [options] Override http request option.
|
|
1441
|
+
* @throws {RequiredError}
|
|
1442
|
+
* @memberof OrdersApi
|
|
1443
|
+
*/
|
|
1444
|
+
getTrade(requestParameters, options) {
|
|
1445
|
+
return OrdersApiFp(this.configuration).getTrade(requestParameters.chainName, requestParameters.tradeId, options).then((request) => request(this.axios, this.basePath));
|
|
1446
|
+
}
|
|
1331
1447
|
/**
|
|
1332
1448
|
* List all listings
|
|
1333
1449
|
* @summary List all listings
|
|
@@ -1339,6 +1455,17 @@ class OrdersApi extends BaseAPI$1 {
|
|
|
1339
1455
|
listListings(requestParameters, options) {
|
|
1340
1456
|
return OrdersApiFp(this.configuration).listListings(requestParameters.chainName, requestParameters.status, requestParameters.sellItemContractAddress, requestParameters.buyItemContractAddress, requestParameters.sellItemTokenId, requestParameters.pageSize, requestParameters.sortBy, requestParameters.sortDirection, requestParameters.pageCursor, options).then((request) => request(this.axios, this.basePath));
|
|
1341
1457
|
}
|
|
1458
|
+
/**
|
|
1459
|
+
* List all trades
|
|
1460
|
+
* @summary List all trades
|
|
1461
|
+
* @param {OrdersApiListTradesRequest} requestParameters Request parameters.
|
|
1462
|
+
* @param {*} [options] Override http request option.
|
|
1463
|
+
* @throws {RequiredError}
|
|
1464
|
+
* @memberof OrdersApi
|
|
1465
|
+
*/
|
|
1466
|
+
listTrades(requestParameters, options) {
|
|
1467
|
+
return OrdersApiFp(this.configuration).listTrades(requestParameters.chainName, requestParameters.pageSize, requestParameters.sortBy, requestParameters.sortDirection, requestParameters.pageCursor, options).then((request) => request(this.axios, this.basePath));
|
|
1468
|
+
}
|
|
1342
1469
|
}
|
|
1343
1470
|
|
|
1344
1471
|
/* tslint:disable */
|
|
@@ -1393,6 +1520,38 @@ const PassportApiAxiosParamCreator = function (configuration) {
|
|
|
1393
1520
|
options: localVarRequestOptions,
|
|
1394
1521
|
};
|
|
1395
1522
|
},
|
|
1523
|
+
/**
|
|
1524
|
+
* Get all the Ethereum linked addresses for a user based on its userId
|
|
1525
|
+
* @summary Get Ethereum linked addresses for a user
|
|
1526
|
+
* @param {string} userId The user\'s userId
|
|
1527
|
+
* @param {*} [options] Override http request option.
|
|
1528
|
+
* @throws {RequiredError}
|
|
1529
|
+
*/
|
|
1530
|
+
getLinkedAddresses: async (userId, options = {}) => {
|
|
1531
|
+
// verify required parameter 'userId' is not null or undefined
|
|
1532
|
+
assertParamExists$1('getLinkedAddresses', 'userId', userId);
|
|
1533
|
+
const localVarPath = `/passport-mr/v1/users/{userId}/linked-addresses`
|
|
1534
|
+
.replace(`{${"userId"}}`, encodeURIComponent(String(userId)));
|
|
1535
|
+
// use dummy base URL string because the URL constructor only accepts absolute URLs.
|
|
1536
|
+
const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL$1);
|
|
1537
|
+
let baseOptions;
|
|
1538
|
+
if (configuration) {
|
|
1539
|
+
baseOptions = configuration.baseOptions;
|
|
1540
|
+
}
|
|
1541
|
+
const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options };
|
|
1542
|
+
const localVarHeaderParameter = {};
|
|
1543
|
+
const localVarQueryParameter = {};
|
|
1544
|
+
// authentication BearerAuth required
|
|
1545
|
+
// http bearer authentication required
|
|
1546
|
+
await setBearerAuthToObject$1(localVarHeaderParameter, configuration);
|
|
1547
|
+
setSearchParams$1(localVarUrlObj, localVarQueryParameter);
|
|
1548
|
+
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
|
|
1549
|
+
localVarRequestOptions.headers = { ...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers };
|
|
1550
|
+
return {
|
|
1551
|
+
url: toPathString$1(localVarUrlObj),
|
|
1552
|
+
options: localVarRequestOptions,
|
|
1553
|
+
};
|
|
1554
|
+
},
|
|
1396
1555
|
};
|
|
1397
1556
|
};
|
|
1398
1557
|
/**
|
|
@@ -1413,6 +1572,17 @@ const PassportApiFp = function (configuration) {
|
|
|
1413
1572
|
const localVarAxiosArgs = await localVarAxiosParamCreator.createCounterfactualAddress(createCounterfactualAddressRequest, options);
|
|
1414
1573
|
return createRequestFunction$1(localVarAxiosArgs, globalAxios$1, BASE_PATH$1, configuration);
|
|
1415
1574
|
},
|
|
1575
|
+
/**
|
|
1576
|
+
* Get all the Ethereum linked addresses for a user based on its userId
|
|
1577
|
+
* @summary Get Ethereum linked addresses for a user
|
|
1578
|
+
* @param {string} userId The user\'s userId
|
|
1579
|
+
* @param {*} [options] Override http request option.
|
|
1580
|
+
* @throws {RequiredError}
|
|
1581
|
+
*/
|
|
1582
|
+
async getLinkedAddresses(userId, options) {
|
|
1583
|
+
const localVarAxiosArgs = await localVarAxiosParamCreator.getLinkedAddresses(userId, options);
|
|
1584
|
+
return createRequestFunction$1(localVarAxiosArgs, globalAxios$1, BASE_PATH$1, configuration);
|
|
1585
|
+
},
|
|
1416
1586
|
};
|
|
1417
1587
|
};
|
|
1418
1588
|
/**
|
|
@@ -1433,6 +1603,17 @@ class PassportApi extends BaseAPI$1 {
|
|
|
1433
1603
|
createCounterfactualAddress(requestParameters, options) {
|
|
1434
1604
|
return PassportApiFp(this.configuration).createCounterfactualAddress(requestParameters.createCounterfactualAddressRequest, options).then((request) => request(this.axios, this.basePath));
|
|
1435
1605
|
}
|
|
1606
|
+
/**
|
|
1607
|
+
* Get all the Ethereum linked addresses for a user based on its userId
|
|
1608
|
+
* @summary Get Ethereum linked addresses for a user
|
|
1609
|
+
* @param {PassportApiGetLinkedAddressesRequest} requestParameters Request parameters.
|
|
1610
|
+
* @param {*} [options] Override http request option.
|
|
1611
|
+
* @throws {RequiredError}
|
|
1612
|
+
* @memberof PassportApi
|
|
1613
|
+
*/
|
|
1614
|
+
getLinkedAddresses(requestParameters, options) {
|
|
1615
|
+
return PassportApiFp(this.configuration).getLinkedAddresses(requestParameters.userId, options).then((request) => request(this.axios, this.basePath));
|
|
1616
|
+
}
|
|
1436
1617
|
}
|
|
1437
1618
|
|
|
1438
1619
|
class MultiRollupApiClients {
|
|
@@ -1457,7 +1638,7 @@ class MultiRollupApiClients {
|
|
|
1457
1638
|
}
|
|
1458
1639
|
|
|
1459
1640
|
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
1460
|
-
const defaultHeaders = { 'x-sdk-version': 'ts-immutable-sdk-0.
|
|
1641
|
+
const defaultHeaders = { 'x-sdk-version': 'ts-immutable-sdk-0.16.0-alpha.1' };
|
|
1461
1642
|
const createConfig = ({ basePath, headers, }) => {
|
|
1462
1643
|
if (!basePath.trim()) {
|
|
1463
1644
|
throw Error('basePath can not be empty');
|
|
@@ -1513,7 +1694,7 @@ const createImmutableXConfiguration = ({ basePath, chainID, coreContractAddress,
|
|
|
1513
1694
|
chainID,
|
|
1514
1695
|
coreContractAddress,
|
|
1515
1696
|
registrationContractAddress,
|
|
1516
|
-
sdkVersion: 'ts-immutable-sdk-0.
|
|
1697
|
+
sdkVersion: 'ts-immutable-sdk-0.16.0-alpha.1',
|
|
1517
1698
|
});
|
|
1518
1699
|
/**
|
|
1519
1700
|
* Sets `sdkVersion` at the time of build
|
|
@@ -5948,6 +6129,12 @@ class AuthManager {
|
|
|
5948
6129
|
userAdminAddress: idTokenPayload?.passport?.imx_user_admin_address,
|
|
5949
6130
|
};
|
|
5950
6131
|
}
|
|
6132
|
+
if (idTokenPayload?.passport?.zkevm_eth_address) {
|
|
6133
|
+
user.zkEvm = {
|
|
6134
|
+
ethAddress: idTokenPayload?.passport?.zkevm_eth_address,
|
|
6135
|
+
userAdminAddress: idTokenPayload?.passport?.zkevm_user_admin_address,
|
|
6136
|
+
};
|
|
6137
|
+
}
|
|
5951
6138
|
return user;
|
|
5952
6139
|
};
|
|
5953
6140
|
async login() {
|
|
@@ -6091,8 +6278,8 @@ class AuthManager {
|
|
|
6091
6278
|
const refreshToken = tokenResponse?.refresh_token ?? null;
|
|
6092
6279
|
if (refreshToken) {
|
|
6093
6280
|
// Token is no longer valid, but refresh token can be used to a new one
|
|
6094
|
-
const
|
|
6095
|
-
return
|
|
6281
|
+
const user = await this.refreshToken(refreshToken);
|
|
6282
|
+
return user;
|
|
6096
6283
|
}
|
|
6097
6284
|
return null;
|
|
6098
6285
|
}, PassportErrorType.AUTHENTICATION_ERROR);
|
|
@@ -6103,7 +6290,8 @@ class AuthManager {
|
|
|
6103
6290
|
grant_type: 'refresh_token',
|
|
6104
6291
|
refresh_token: refreshToken,
|
|
6105
6292
|
}, formUrlEncodedHeader);
|
|
6106
|
-
|
|
6293
|
+
const newTokenResponse = response.data;
|
|
6294
|
+
return AuthManager.mapDeviceTokenResponseToDomainUserModel(newTokenResponse);
|
|
6107
6295
|
}
|
|
6108
6296
|
async logout() {
|
|
6109
6297
|
return withPassportError(async () => {
|
|
@@ -7262,7 +7450,7 @@ class RelayerClient {
|
|
|
7262
7450
|
}
|
|
7263
7451
|
|
|
7264
7452
|
const MESSAGE_TO_SIGN = 'Only sign this message from Immutable Passport';
|
|
7265
|
-
async function registerZkEvmUser({ authManager, magicProvider, multiRollupApiClients, accessToken, }) {
|
|
7453
|
+
async function registerZkEvmUser({ authManager, config, magicProvider, multiRollupApiClients, accessToken, }) {
|
|
7266
7454
|
const web3Provider = new Web3Provider(magicProvider);
|
|
7267
7455
|
const ethSigner = web3Provider.getSigner();
|
|
7268
7456
|
const ethereumAddress = await ethSigner.getAddress();
|
|
@@ -7279,7 +7467,17 @@ async function registerZkEvmUser({ authManager, magicProvider, multiRollupApiCli
|
|
|
7279
7467
|
catch (error) {
|
|
7280
7468
|
throw new JsonRpcError(RpcErrorCode.INTERNAL_ERROR, `Failed to create counterfactual address: ${error}`);
|
|
7281
7469
|
}
|
|
7282
|
-
|
|
7470
|
+
let user;
|
|
7471
|
+
if (config.crossSdkBridgeEnabled) {
|
|
7472
|
+
const credentials = authManager.checkStoredDeviceFlowCredentials();
|
|
7473
|
+
if (!credentials || !credentials.refresh_token) {
|
|
7474
|
+
throw new JsonRpcError(RpcErrorCode.INTERNAL_ERROR, 'Cross SDK bridge: Failed to refresh user details');
|
|
7475
|
+
}
|
|
7476
|
+
user = await authManager.refreshToken(credentials.refresh_token);
|
|
7477
|
+
}
|
|
7478
|
+
else {
|
|
7479
|
+
user = await authManager.loginSilent();
|
|
7480
|
+
}
|
|
7283
7481
|
if (!user?.zkEvm) {
|
|
7284
7482
|
throw new JsonRpcError(RpcErrorCode.INTERNAL_ERROR, 'Failed to refresh user details');
|
|
7285
7483
|
}
|
|
@@ -7287,7 +7485,7 @@ async function registerZkEvmUser({ authManager, magicProvider, multiRollupApiCli
|
|
|
7287
7485
|
}
|
|
7288
7486
|
|
|
7289
7487
|
const loginZkEvmUser = async ({ authManager, config, magicAdapter, multiRollupApiClients, }) => {
|
|
7290
|
-
const user = await authManager.getUser() || await authManager.login();
|
|
7488
|
+
const user = await authManager.getUser() || await authManager.getUserDeviceFlow() || await authManager.login();
|
|
7291
7489
|
if (!user.idToken) {
|
|
7292
7490
|
throw new Error('User is missing idToken');
|
|
7293
7491
|
}
|
|
@@ -7296,6 +7494,7 @@ const loginZkEvmUser = async ({ authManager, config, magicAdapter, multiRollupAp
|
|
|
7296
7494
|
// Generate counterfactual address and retrieve updated Auth0 user
|
|
7297
7495
|
const userZkevm = await registerZkEvmUser({
|
|
7298
7496
|
authManager,
|
|
7497
|
+
config,
|
|
7299
7498
|
magicProvider,
|
|
7300
7499
|
multiRollupApiClients,
|
|
7301
7500
|
accessToken: user.accessToken,
|
|
@@ -7694,6 +7893,17 @@ class Passport {
|
|
|
7694
7893
|
const user = await this.authManager.getUser();
|
|
7695
7894
|
return user?.accessToken;
|
|
7696
7895
|
}
|
|
7896
|
+
async getLinkedAddresses() {
|
|
7897
|
+
const user = await this.authManager.getUser();
|
|
7898
|
+
if (!user?.profile.sub) {
|
|
7899
|
+
return [];
|
|
7900
|
+
}
|
|
7901
|
+
const headers = { Authorization: `Bearer ${user.accessToken}` };
|
|
7902
|
+
const linkedAddressesResult = await this.multiRollupApiClients.passportApi.getLinkedAddresses({
|
|
7903
|
+
userId: user?.profile.sub,
|
|
7904
|
+
}, { headers });
|
|
7905
|
+
return linkedAddressesResult.data.linkedAddresses;
|
|
7906
|
+
}
|
|
7697
7907
|
}
|
|
7698
7908
|
|
|
7699
7909
|
export { JsonRpcError, Networks, Passport, PassportError, ProviderErrorCode, ProviderEvent, RpcErrorCode };
|
package/package.json
CHANGED