@imtbl/sdk 0.0.1-alpha → 0.0.1-alpha.2
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/base.d.ts +119 -14
- package/dist/base.js +20 -8
- package/dist/browser/checkout.js +2 -2
- package/dist/checkout_sdk.d.ts +1 -33
- package/dist/checkout_sdk.js +63 -66
- package/dist/checkout_widgets.d.ts +1 -3
- package/dist/checkout_widgets.js +11 -16
- package/dist/index.cjs +216 -226
- package/dist/index.d.ts +39 -96
- package/dist/index.js +216 -227
- package/dist/passport.d.ts +14 -40
- package/dist/passport.js +91 -95
- package/dist/provider.d.ts +20 -36
- package/dist/provider.js +55 -66
- package/dist/starkex.d.ts +40 -6
- package/dist/starkex.js +1 -1
- package/package.json +2 -11
package/dist/provider.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { Config, TransfersApi, OrdersApi, UsersApi, Contracts, TradesApi, ExchangesApi, WithdrawalsApi, MintsApi, DepositsApi, EncodingApi, TokensApi } from '@imtbl/core-sdk';
|
|
2
1
|
import BN from 'bn.js';
|
|
3
2
|
import * as encUtils from 'enc-utils';
|
|
3
|
+
import { Config, TransfersApi, OrdersApi, UsersApi, Contracts, TradesApi, ExchangesApi, WithdrawalsApi, MintsApi, DepositsApi, EncodingApi, TokensApi } from '@imtbl/core-sdk';
|
|
4
4
|
import { parseUnits } from '@ethersproject/units';
|
|
5
5
|
import { BigNumber } from '@ethersproject/bignumber';
|
|
6
6
|
import { ethers } from 'ethers';
|
|
@@ -78,9 +78,18 @@ function convertToSignableToken(token) {
|
|
|
78
78
|
|
|
79
79
|
var Environment;
|
|
80
80
|
(function (Environment) {
|
|
81
|
-
Environment["
|
|
81
|
+
Environment["DEVELOPMENT"] = "development";
|
|
82
82
|
Environment["SANDBOX"] = "sandbox";
|
|
83
|
+
Environment["PRODUCTION"] = "production";
|
|
83
84
|
})(Environment || (Environment = {}));
|
|
85
|
+
({
|
|
86
|
+
...Config.PRODUCTION,
|
|
87
|
+
env: Environment.PRODUCTION,
|
|
88
|
+
});
|
|
89
|
+
({
|
|
90
|
+
...Config.SANDBOX,
|
|
91
|
+
env: Environment.SANDBOX,
|
|
92
|
+
});
|
|
84
93
|
|
|
85
94
|
function isChainValid(chainID, config) {
|
|
86
95
|
return chainID === config.ethConfiguration.chainID;
|
|
@@ -92,9 +101,9 @@ async function validateChain(signer, config) {
|
|
|
92
101
|
}
|
|
93
102
|
|
|
94
103
|
async function transfer({ signers: { ethSigner, starkExSigner }, request, config, }) {
|
|
95
|
-
await validateChain(ethSigner, config.
|
|
104
|
+
await validateChain(ethSigner, config.getStarkExConfig());
|
|
96
105
|
const ethAddress = await ethSigner.getAddress();
|
|
97
|
-
const transfersApi = new TransfersApi(config.
|
|
106
|
+
const transfersApi = new TransfersApi(config.getStarkExConfig().apiConfiguration);
|
|
98
107
|
const transferAmount = request.type === 'ERC721' ? '1' : request.amount;
|
|
99
108
|
const signableResult = await transfersApi.getSignableTransferV1({
|
|
100
109
|
getSignableTransferRequest: {
|
|
@@ -132,9 +141,9 @@ async function transfer({ signers: { ethSigner, starkExSigner }, request, config
|
|
|
132
141
|
};
|
|
133
142
|
}
|
|
134
143
|
async function batchTransfer({ signers: { ethSigner, starkExSigner }, request, config, }) {
|
|
135
|
-
await validateChain(ethSigner, config.
|
|
144
|
+
await validateChain(ethSigner, config.getStarkExConfig());
|
|
136
145
|
const ethAddress = await ethSigner.getAddress();
|
|
137
|
-
const transfersApi = new TransfersApi(config.
|
|
146
|
+
const transfersApi = new TransfersApi(config.getStarkExConfig().apiConfiguration);
|
|
138
147
|
const signableRequests = request.map((nftTransfer) => {
|
|
139
148
|
return {
|
|
140
149
|
amount: '1',
|
|
@@ -188,9 +197,9 @@ async function batchTransfer({ signers: { ethSigner, starkExSigner }, request, c
|
|
|
188
197
|
}
|
|
189
198
|
|
|
190
199
|
async function createOrder({ signers, request, config, }) {
|
|
191
|
-
await validateChain(signers.ethSigner, config.
|
|
200
|
+
await validateChain(signers.ethSigner, config.getStarkExConfig());
|
|
192
201
|
const ethAddress = await signers.ethSigner.getAddress();
|
|
193
|
-
const ordersApi = new OrdersApi(config.
|
|
202
|
+
const ordersApi = new OrdersApi(config.getStarkExConfig().apiConfiguration);
|
|
194
203
|
const amountSell = request.sell.type === 'ERC721' ? '1' : request.sell.amount;
|
|
195
204
|
const amountBuy = request.buy.type === 'ERC721' ? '1' : request.buy.amount;
|
|
196
205
|
const getSignableOrderRequest = {
|
|
@@ -233,7 +242,7 @@ async function createOrder({ signers, request, config, }) {
|
|
|
233
242
|
};
|
|
234
243
|
}
|
|
235
244
|
async function cancelOrder({ signers, request, config, }) {
|
|
236
|
-
const ordersApi = new OrdersApi(config.
|
|
245
|
+
const ordersApi = new OrdersApi(config.getStarkExConfig().apiConfiguration);
|
|
237
246
|
const getSignableCancelOrderResponse = await ordersApi.getSignableCancelOrder({
|
|
238
247
|
getSignableCancelOrderRequest: {
|
|
239
248
|
order_id: request.order_id,
|
|
@@ -259,8 +268,8 @@ async function cancelOrder({ signers, request, config, }) {
|
|
|
259
268
|
}
|
|
260
269
|
|
|
261
270
|
async function registerOffchain(signers, config) {
|
|
262
|
-
await validateChain(signers.ethSigner, config.
|
|
263
|
-
const usersApi = new UsersApi(config.
|
|
271
|
+
await validateChain(signers.ethSigner, config.getStarkExConfig());
|
|
272
|
+
const usersApi = new UsersApi(config.getStarkExConfig().apiConfiguration);
|
|
264
273
|
const userAddress = await signers.ethSigner.getAddress();
|
|
265
274
|
const starkPublicKey = await signers.starkExSigner.getAddress();
|
|
266
275
|
const signableResult = await usersApi.getSignableRegistrationOffchain({
|
|
@@ -283,8 +292,8 @@ async function registerOffchain(signers, config) {
|
|
|
283
292
|
return registeredUser.data;
|
|
284
293
|
}
|
|
285
294
|
async function isRegisteredOnChain(starkPublicKey, ethSigner, config) {
|
|
286
|
-
await validateChain(ethSigner, config.
|
|
287
|
-
const registrationContract = Contracts.Registration.connect(config.
|
|
295
|
+
await validateChain(ethSigner, config.getStarkExConfig());
|
|
296
|
+
const registrationContract = Contracts.Registration.connect(config.getStarkExConfig().ethConfiguration.registrationContractAddress, ethSigner);
|
|
288
297
|
try {
|
|
289
298
|
return await registrationContract.isRegistered(starkPublicKey);
|
|
290
299
|
}
|
|
@@ -359,10 +368,10 @@ async function getEncodeAssetInfo(assetType, tokenType, config, tokenData) {
|
|
|
359
368
|
|
|
360
369
|
async function executeRegisterAndWithdrawERC20({ ethSigner, assetType, starkPublicKey, config, }) {
|
|
361
370
|
const etherKey = await ethSigner.getAddress();
|
|
362
|
-
const starkExConfig = config.
|
|
371
|
+
const starkExConfig = config.getStarkExConfig();
|
|
363
372
|
const usersApi = new UsersApi(starkExConfig.apiConfiguration);
|
|
364
373
|
const signableResult = await getSignableRegistrationOnchain(etherKey, starkPublicKey, usersApi);
|
|
365
|
-
const contract = Contracts.Registration.connect(config.
|
|
374
|
+
const contract = Contracts.Registration.connect(config.getStarkExConfig().ethConfiguration.registrationContractAddress, ethSigner);
|
|
366
375
|
const populatedTransaction = await contract.populateTransaction.registerAndWithdraw(etherKey, starkPublicKey, signableResult.operator_signature, assetType);
|
|
367
376
|
return ethSigner.sendTransaction(populatedTransaction);
|
|
368
377
|
}
|
|
@@ -372,8 +381,8 @@ async function executeWithdrawERC20(ethSigner, assetType, starkPublicKey, config
|
|
|
372
381
|
return ethSigner.sendTransaction(populatedTransaction);
|
|
373
382
|
}
|
|
374
383
|
async function completeERC20WithdrawalAction({ ethSigner, starkPublicKey, token, config, }) {
|
|
375
|
-
await validateChain(ethSigner, config.
|
|
376
|
-
const starkExConfig = config.
|
|
384
|
+
await validateChain(ethSigner, config.getStarkExConfig());
|
|
385
|
+
const starkExConfig = config.getStarkExConfig();
|
|
377
386
|
const assetType = await getEncodeAssetInfo('asset', 'ERC20', starkExConfig, {
|
|
378
387
|
token_address: token.tokenAddress,
|
|
379
388
|
});
|
|
@@ -410,7 +419,7 @@ function getMintingBlob(token) {
|
|
|
410
419
|
return encUtils.sanitizeHex(encUtils.utf8ToHex(`{${id}}:{${blueprint}}`));
|
|
411
420
|
}
|
|
412
421
|
async function completeMintableERC721Withdrawal(ethSigner, starkPublicKey, token, config) {
|
|
413
|
-
const starkExConfig = config.
|
|
422
|
+
const starkExConfig = config.getStarkExConfig();
|
|
414
423
|
const assetType = await getEncodeAssetInfo('mintable-asset', 'ERC721', starkExConfig, {
|
|
415
424
|
id: token.data.id,
|
|
416
425
|
token_address: token.data.tokenAddress,
|
|
@@ -439,7 +448,7 @@ async function executeWithdrawERC721(ethSigner, assetType, starkPublicKey, token
|
|
|
439
448
|
return ethSigner.sendTransaction(populatedTransaction);
|
|
440
449
|
}
|
|
441
450
|
async function completeERC721Withdrawal(ethSigner, starkPublicKey, token, config) {
|
|
442
|
-
const starkExConfig = config.
|
|
451
|
+
const starkExConfig = config.getStarkExConfig();
|
|
443
452
|
const assetType = await getEncodeAssetInfo('asset', 'ERC721', starkExConfig, {
|
|
444
453
|
token_id: token.tokenId,
|
|
445
454
|
token_address: token.tokenAddress,
|
|
@@ -453,10 +462,10 @@ async function completeERC721Withdrawal(ethSigner, starkPublicKey, token, config
|
|
|
453
462
|
}
|
|
454
463
|
}
|
|
455
464
|
async function completeERC721WithdrawalAction({ ethSigner, starkPublicKey, token, config, }) {
|
|
456
|
-
await validateChain(ethSigner, config.
|
|
465
|
+
await validateChain(ethSigner, config.getStarkExConfig());
|
|
457
466
|
const tokenAddress = token.tokenAddress;
|
|
458
467
|
const tokenId = token.tokenId;
|
|
459
|
-
const starkExConfig = config.
|
|
468
|
+
const starkExConfig = config.getStarkExConfig();
|
|
460
469
|
const mintsApi = new MintsApi(starkExConfig.apiConfiguration);
|
|
461
470
|
return await mintsApi
|
|
462
471
|
.getMintableTokenDetailsByClientTokenId({
|
|
@@ -494,8 +503,8 @@ async function executeWithdrawEth(ethSigner, assetType, starkPublicKey, config)
|
|
|
494
503
|
return ethSigner.sendTransaction(populatedTransaction);
|
|
495
504
|
}
|
|
496
505
|
async function completeEthWithdrawalAction({ ethSigner, starkPublicKey, config, }) {
|
|
497
|
-
await validateChain(ethSigner, config.
|
|
498
|
-
const starkExConfig = config.
|
|
506
|
+
await validateChain(ethSigner, config.getStarkExConfig());
|
|
507
|
+
const starkExConfig = config.getStarkExConfig();
|
|
499
508
|
const assetType = await getEncodeAssetInfo('asset', 'ETH', starkExConfig);
|
|
500
509
|
const isRegistered = await isRegisteredOnChain(starkPublicKey, ethSigner, config);
|
|
501
510
|
if (!isRegistered) {
|
|
@@ -507,9 +516,10 @@ async function completeEthWithdrawalAction({ ethSigner, starkPublicKey, config,
|
|
|
507
516
|
}
|
|
508
517
|
|
|
509
518
|
async function prepareWithdrawal({ signers, withdrawal, config, }) {
|
|
519
|
+
const starkExConfig = config.getStarkExConfig();
|
|
510
520
|
return prepareWithdrawalAction({
|
|
511
521
|
signers,
|
|
512
|
-
config:
|
|
522
|
+
config: starkExConfig,
|
|
513
523
|
...withdrawal,
|
|
514
524
|
});
|
|
515
525
|
}
|
|
@@ -535,9 +545,9 @@ async function completeWithdrawal({ signers: { ethSigner }, starkPublicKey, toke
|
|
|
535
545
|
}
|
|
536
546
|
|
|
537
547
|
async function createTrade({ signers: { ethSigner, starkExSigner }, request, config, }) {
|
|
538
|
-
await validateChain(ethSigner, config.
|
|
548
|
+
await validateChain(ethSigner, config.getStarkExConfig());
|
|
539
549
|
const ethAddress = await ethSigner.getAddress();
|
|
540
|
-
const tradesApi = new TradesApi(config.
|
|
550
|
+
const tradesApi = new TradesApi(config.getStarkExConfig().apiConfiguration);
|
|
541
551
|
const signableResult = await tradesApi.getSignableTrade({
|
|
542
552
|
getSignableTradeRequest: {
|
|
543
553
|
user: ethAddress,
|
|
@@ -572,13 +582,13 @@ async function createTrade({ signers: { ethSigner, starkExSigner }, request, con
|
|
|
572
582
|
}
|
|
573
583
|
|
|
574
584
|
async function depositEth({ signers: { ethSigner }, deposit, config, }) {
|
|
575
|
-
await validateChain(ethSigner, config.
|
|
585
|
+
await validateChain(ethSigner, config.getStarkExConfig());
|
|
576
586
|
const user = await ethSigner.getAddress();
|
|
577
587
|
const data = {
|
|
578
588
|
decimals: 18,
|
|
579
589
|
};
|
|
580
590
|
const amount = parseUnits(deposit.amount, 'wei');
|
|
581
|
-
const starkExConfig = config.
|
|
591
|
+
const starkExConfig = config.getStarkExConfig();
|
|
582
592
|
const depositsApi = new DepositsApi(starkExConfig.apiConfiguration);
|
|
583
593
|
const encodingApi = new EncodingApi(starkExConfig.apiConfiguration);
|
|
584
594
|
const usersApi = new UsersApi(starkExConfig.apiConfiguration);
|
|
@@ -626,8 +636,8 @@ async function executeDepositEth(ethSigner, amount, assetType, starkPublicKey, v
|
|
|
626
636
|
}
|
|
627
637
|
|
|
628
638
|
async function depositERC20({ signers: { ethSigner }, deposit, config, }) {
|
|
629
|
-
await validateChain(ethSigner, config.
|
|
630
|
-
const { apiConfiguration, ethConfiguration } = config.
|
|
639
|
+
await validateChain(ethSigner, config.getStarkExConfig());
|
|
640
|
+
const { apiConfiguration, ethConfiguration } = config.getStarkExConfig();
|
|
631
641
|
const user = await ethSigner.getAddress();
|
|
632
642
|
const tokensApi = new TokensApi(apiConfiguration);
|
|
633
643
|
const depositsApi = new DepositsApi(apiConfiguration);
|
|
@@ -694,12 +704,12 @@ async function executeRegisterAndDepositERC20(ethSigner, quantizedAmount, assetT
|
|
|
694
704
|
}
|
|
695
705
|
|
|
696
706
|
async function depositERC721({ signers: { ethSigner }, deposit, config, }) {
|
|
697
|
-
await validateChain(ethSigner, config.
|
|
707
|
+
await validateChain(ethSigner, config.getStarkExConfig());
|
|
698
708
|
const user = await ethSigner.getAddress();
|
|
699
|
-
const
|
|
700
|
-
const depositsApi = new DepositsApi(
|
|
701
|
-
const encodingApi = new EncodingApi(
|
|
702
|
-
const usersApi = new UsersApi(
|
|
709
|
+
const starkExConfig = config.getStarkExConfig();
|
|
710
|
+
const depositsApi = new DepositsApi(starkExConfig.apiConfiguration);
|
|
711
|
+
const encodingApi = new EncodingApi(starkExConfig.apiConfiguration);
|
|
712
|
+
const usersApi = new UsersApi(starkExConfig.apiConfiguration);
|
|
703
713
|
const data = {
|
|
704
714
|
token_address: deposit.tokenAddress,
|
|
705
715
|
token_id: deposit.tokenId,
|
|
@@ -735,18 +745,18 @@ async function depositERC721({ signers: { ethSigner }, deposit, config, }) {
|
|
|
735
745
|
const isRegistered = await isRegisteredOnChain(starkPublicKey, ethSigner, config);
|
|
736
746
|
// Approve whether an amount of token from an account can be spent by a third-party account
|
|
737
747
|
const tokenContract = Contracts.IERC721.connect(deposit.tokenAddress, ethSigner);
|
|
738
|
-
const operator =
|
|
748
|
+
const operator = starkExConfig.ethConfiguration.coreContractAddress;
|
|
739
749
|
const isApprovedForAll = await tokenContract.isApprovedForAll(user, operator);
|
|
740
750
|
if (!isApprovedForAll) {
|
|
741
751
|
await tokenContract.setApprovalForAll(operator, true);
|
|
742
752
|
}
|
|
743
753
|
if (!isRegistered) {
|
|
744
754
|
const signableResult = await getSignableRegistrationOnchain(user, starkPublicKey, usersApi);
|
|
745
|
-
const coreContract = Contracts.Core.connect(
|
|
755
|
+
const coreContract = Contracts.Core.connect(starkExConfig.ethConfiguration.coreContractAddress, ethSigner);
|
|
746
756
|
// Note: proxy registration contract registerAndDepositNft method is not used as it currently fails erc721 transfer ownership check
|
|
747
757
|
await coreContract.registerUser(user, starkPublicKey, signableResult.operator_signature);
|
|
748
758
|
}
|
|
749
|
-
return executeDepositERC721(ethSigner, deposit.tokenId, assetType, starkPublicKey, vaultId,
|
|
759
|
+
return executeDepositERC721(ethSigner, deposit.tokenId, assetType, starkPublicKey, vaultId, starkExConfig);
|
|
750
760
|
}
|
|
751
761
|
async function executeDepositERC721(ethSigner, tokenId, assetType, starkPublicKey, vaultId, config) {
|
|
752
762
|
const coreContract = Contracts.Core.connect(config.ethConfiguration.coreContractAddress, ethSigner);
|
|
@@ -766,8 +776,8 @@ async function deposit({ signers, deposit, config }) {
|
|
|
766
776
|
}
|
|
767
777
|
|
|
768
778
|
async function exchangeTransfer({ signers, request, config, }) {
|
|
769
|
-
await validateChain(signers.ethSigner, config.
|
|
770
|
-
const exchangeApi = new ExchangesApi(config.
|
|
779
|
+
await validateChain(signers.ethSigner, config.getStarkExConfig());
|
|
780
|
+
const exchangeApi = new ExchangesApi(config.getStarkExConfig().apiConfiguration);
|
|
771
781
|
const ethAddress = await signers.ethSigner.getAddress();
|
|
772
782
|
const transferAmount = request.amount;
|
|
773
783
|
const signableResult = await exchangeApi.getExchangeSignableTransfer({
|
|
@@ -990,6 +1000,7 @@ class ImxSigner {
|
|
|
990
1000
|
|
|
991
1001
|
const IMX_WALLET_IFRAME_ID = 'imx-wallet-app';
|
|
992
1002
|
const IMX_WALLET_IFRAME_HOSTS = {
|
|
1003
|
+
[Environment.DEVELOPMENT]: 'http://localhost:8080',
|
|
993
1004
|
[Environment.SANDBOX]: 'https://wallets.sandbox.immutable.com',
|
|
994
1005
|
[Environment.PRODUCTION]: 'https://wallets.immutable.com',
|
|
995
1006
|
};
|
|
@@ -1087,11 +1098,12 @@ class MetaMaskIMXProvider extends GenericIMXProvider {
|
|
|
1087
1098
|
super(config, ethSigner, starkExSigner);
|
|
1088
1099
|
}
|
|
1089
1100
|
static async connect(config) {
|
|
1101
|
+
const starkExConfig = config.getStarkExConfig();
|
|
1090
1102
|
return await withProviderError(async () => {
|
|
1091
1103
|
const metaMaskProvider = await connect$1({
|
|
1092
|
-
chainID:
|
|
1104
|
+
chainID: starkExConfig.ethConfiguration.chainID,
|
|
1093
1105
|
});
|
|
1094
|
-
this.imxSigner = await connect(metaMaskProvider,
|
|
1106
|
+
this.imxSigner = await connect(metaMaskProvider, starkExConfig.env);
|
|
1095
1107
|
return new MetaMaskIMXProvider(config, metaMaskProvider.getSigner(), this.imxSigner);
|
|
1096
1108
|
}, { type: ProviderErrorType.WALLET_CONNECTION_ERROR });
|
|
1097
1109
|
}
|
|
@@ -1113,27 +1125,4 @@ class MetaMaskIMXProvider extends GenericIMXProvider {
|
|
|
1113
1125
|
}
|
|
1114
1126
|
}
|
|
1115
1127
|
|
|
1116
|
-
|
|
1117
|
-
immutableXConfig;
|
|
1118
|
-
baseConfig;
|
|
1119
|
-
constructor({ baseConfig, overrides }) {
|
|
1120
|
-
this.baseConfig = baseConfig;
|
|
1121
|
-
if (overrides) {
|
|
1122
|
-
this.immutableXConfig = overrides.immutableXConfig;
|
|
1123
|
-
}
|
|
1124
|
-
else {
|
|
1125
|
-
switch (baseConfig.environment) {
|
|
1126
|
-
case Environment.SANDBOX: {
|
|
1127
|
-
this.immutableXConfig = Config.SANDBOX;
|
|
1128
|
-
break;
|
|
1129
|
-
}
|
|
1130
|
-
case Environment.PRODUCTION: {
|
|
1131
|
-
this.immutableXConfig = Config.PRODUCTION;
|
|
1132
|
-
break;
|
|
1133
|
-
}
|
|
1134
|
-
}
|
|
1135
|
-
}
|
|
1136
|
-
}
|
|
1137
|
-
}
|
|
1138
|
-
|
|
1139
|
-
export { GenericIMXProvider, MetaMaskIMXProvider, ProviderConfiguration };
|
|
1128
|
+
export { GenericIMXProvider, MetaMaskIMXProvider };
|
package/dist/starkex.d.ts
CHANGED
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import { StarkExConfiguration } from 'config';
|
|
2
|
-
|
|
3
1
|
// TypeScript Version: 3.0
|
|
4
2
|
|
|
5
3
|
type AxiosRequestHeaders = Record<string, string | number | boolean>;
|
|
@@ -199,7 +197,7 @@ interface ConfigurationParameters {
|
|
|
199
197
|
baseOptions?: any;
|
|
200
198
|
formDataCtor?: new () => any;
|
|
201
199
|
}
|
|
202
|
-
declare class Configuration {
|
|
200
|
+
declare class Configuration$1 {
|
|
203
201
|
/**
|
|
204
202
|
* parameter for apiKey security
|
|
205
203
|
* @param name security name
|
|
@@ -270,8 +268,8 @@ declare class Configuration {
|
|
|
270
268
|
declare class BaseAPI {
|
|
271
269
|
protected basePath: string;
|
|
272
270
|
protected axios: AxiosInstance;
|
|
273
|
-
protected configuration: Configuration | undefined;
|
|
274
|
-
constructor(configuration?: Configuration, basePath?: string, axios?: AxiosInstance);
|
|
271
|
+
protected configuration: Configuration$1 | undefined;
|
|
272
|
+
constructor(configuration?: Configuration$1, basePath?: string, axios?: AxiosInstance);
|
|
275
273
|
}
|
|
276
274
|
|
|
277
275
|
/**
|
|
@@ -8399,7 +8397,43 @@ declare class WithdrawalsApi extends BaseAPI {
|
|
|
8399
8397
|
listWithdrawals(requestParameters?: WithdrawalsApiListWithdrawalsRequest, options?: AxiosRequestConfig): Promise<AxiosResponse<ListWithdrawalsResponse, any>>;
|
|
8400
8398
|
}
|
|
8401
8399
|
|
|
8402
|
-
|
|
8400
|
+
/**
|
|
8401
|
+
* The configuration for the Ethereum network
|
|
8402
|
+
*/
|
|
8403
|
+
interface EthConfiguration {
|
|
8404
|
+
coreContractAddress: string;
|
|
8405
|
+
registrationContractAddress: string;
|
|
8406
|
+
chainID: number;
|
|
8407
|
+
}
|
|
8408
|
+
/**
|
|
8409
|
+
* The configuration for the ImmutableX client
|
|
8410
|
+
*/
|
|
8411
|
+
interface ImmutableXConfiguration {
|
|
8412
|
+
/**
|
|
8413
|
+
* The configuration for the API client
|
|
8414
|
+
*/
|
|
8415
|
+
apiConfiguration: Configuration$1;
|
|
8416
|
+
/**
|
|
8417
|
+
* The configuration for the Ethereum network
|
|
8418
|
+
*/
|
|
8419
|
+
ethConfiguration: EthConfiguration;
|
|
8420
|
+
}
|
|
8421
|
+
|
|
8422
|
+
declare enum Environment {
|
|
8423
|
+
DEVELOPMENT = "development",
|
|
8424
|
+
SANDBOX = "sandbox",
|
|
8425
|
+
PRODUCTION = "production"
|
|
8426
|
+
}
|
|
8427
|
+
type StarkExConfig = ImmutableXConfiguration & {
|
|
8428
|
+
env: Environment;
|
|
8429
|
+
};
|
|
8430
|
+
declare class Configuration {
|
|
8431
|
+
private readonly starkExConfig;
|
|
8432
|
+
constructor(config: StarkExConfig);
|
|
8433
|
+
getStarkExConfig(): StarkExConfig;
|
|
8434
|
+
}
|
|
8435
|
+
|
|
8436
|
+
declare const StarkExAPIFactory: (config: Configuration) => {
|
|
8403
8437
|
depositsApi: DepositsApi;
|
|
8404
8438
|
mintsApi: MintsApi;
|
|
8405
8439
|
ordersApi: OrdersApi;
|
package/dist/starkex.js
CHANGED
|
@@ -2,7 +2,7 @@ import { ImmutableX } from '@imtbl/core-sdk';
|
|
|
2
2
|
|
|
3
3
|
/* eslint-disable @typescript-eslint/no-unused-vars */
|
|
4
4
|
const StarkExAPIFactory = (config) => {
|
|
5
|
-
const imtblClient = new ImmutableX(config.
|
|
5
|
+
const imtblClient = new ImmutableX(config.getStarkExConfig());
|
|
6
6
|
const { deposit, registerOffchain, isRegisteredOnchain, prepareWithdrawal, completeWithdrawal, createOrder, cancelOrder, createTrade, transfer, batchNftTransfer, ...StarkEx } = imtblClient;
|
|
7
7
|
return { ...StarkEx };
|
|
8
8
|
};
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@imtbl/sdk",
|
|
3
3
|
"description": "Immutable Unified SDK",
|
|
4
|
-
"version": "0.0.1-alpha",
|
|
4
|
+
"version": "0.0.1-alpha.2",
|
|
5
5
|
"author": "Immutable",
|
|
6
6
|
"bugs": "https://github.com/immutable/ts-immutable-sdk/issues",
|
|
7
7
|
"dependencies": {
|
|
@@ -11,14 +11,6 @@
|
|
|
11
11
|
"@imtbl/core-sdk": "^1.0.2-alpha.5",
|
|
12
12
|
"@magic-ext/oidc": "^1.0.1",
|
|
13
13
|
"@metamask/detect-provider": "^2.0.0",
|
|
14
|
-
"@swc/helpers": "~0.5.0",
|
|
15
|
-
"@typescript-eslint/eslint-plugin": "^5.57.1",
|
|
16
|
-
"@typescript-eslint/parser": "^5.57.1",
|
|
17
|
-
"@uniswap/router-sdk": "^1.4.0",
|
|
18
|
-
"@uniswap/swap-router-contracts": "^1.3.0",
|
|
19
|
-
"@uniswap/v3-core": "^1.0.1",
|
|
20
|
-
"@uniswap/v3-periphery": "^1.4.3",
|
|
21
|
-
"@uniswap/v3-sdk": "^3.9.0",
|
|
22
14
|
"axios": "^1.3.5",
|
|
23
15
|
"eslint": "^8.37.0",
|
|
24
16
|
"ethers": "^5.7.2",
|
|
@@ -26,8 +18,7 @@
|
|
|
26
18
|
"oidc-client-ts": "^2.2.1",
|
|
27
19
|
"react": "^18.2.0",
|
|
28
20
|
"react-dom": "^18.2.0",
|
|
29
|
-
"react-router-dom": "^6.10.0"
|
|
30
|
-
"rxjs": "^7.8.0"
|
|
21
|
+
"react-router-dom": "^6.10.0"
|
|
31
22
|
},
|
|
32
23
|
"devDependencies": {
|
|
33
24
|
"@imtbl/checkout-sdk-web": "0.0.0",
|