@imtbl/sdk 0.0.1-alpha.1 → 0.0.1-alpha.3
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 +14 -119
- package/dist/base.js +8 -20
- package/dist/browser/checkout.js +2 -0
- package/dist/checkout_sdk.d.ts +692 -0
- package/dist/checkout_sdk.js +553 -0
- package/dist/checkout_widgets.d.ts +14447 -0
- package/dist/checkout_widgets.js +198 -0
- package/dist/index.cjs +844 -154
- package/dist/index.d.ts +20637 -4534
- package/dist/index.js +844 -155
- package/dist/passport.d.ts +40 -14
- package/dist/passport.js +96 -92
- package/dist/provider.d.ts +36 -20
- package/dist/provider.js +66 -55
- package/dist/starkex.d.ts +2015 -824
- package/dist/starkex.js +52 -4
- package/package.json +32 -4
package/dist/passport.d.ts
CHANGED
|
@@ -663,6 +663,23 @@ interface IMXProvider {
|
|
|
663
663
|
completeWithdrawal(starkPublicKey: string, token: AnyToken): Promise<TransactionResponse>;
|
|
664
664
|
}
|
|
665
665
|
|
|
666
|
+
declare enum Environment {
|
|
667
|
+
PRODUCTION = "production",
|
|
668
|
+
SANDBOX = "sandbox"
|
|
669
|
+
}
|
|
670
|
+
declare class ImmutableConfiguration {
|
|
671
|
+
readonly environment: Environment;
|
|
672
|
+
readonly apiKey?: string;
|
|
673
|
+
constructor(options: {
|
|
674
|
+
environment: Environment;
|
|
675
|
+
apiKey?: string;
|
|
676
|
+
});
|
|
677
|
+
}
|
|
678
|
+
interface ModuleConfiguration<T> {
|
|
679
|
+
baseConfig: ImmutableConfiguration;
|
|
680
|
+
overrides?: T;
|
|
681
|
+
}
|
|
682
|
+
|
|
666
683
|
type UserProfile = {
|
|
667
684
|
email?: string;
|
|
668
685
|
nickname?: string;
|
|
@@ -672,14 +689,6 @@ declare enum Networks {
|
|
|
672
689
|
PRODUCTION = "mainnet",
|
|
673
690
|
SANDBOX = "goerli"
|
|
674
691
|
}
|
|
675
|
-
interface EnvironmentConfiguration {
|
|
676
|
-
network: Networks;
|
|
677
|
-
authenticationDomain: string;
|
|
678
|
-
magicPublishableApiKey: string;
|
|
679
|
-
magicProviderId: string;
|
|
680
|
-
baseIMXApiPath: string;
|
|
681
|
-
passportDomain: string;
|
|
682
|
-
}
|
|
683
692
|
interface OidcConfiguration {
|
|
684
693
|
clientId: string;
|
|
685
694
|
logoutRedirectUri: string;
|
|
@@ -687,12 +696,22 @@ interface OidcConfiguration {
|
|
|
687
696
|
scope?: string;
|
|
688
697
|
audience?: string;
|
|
689
698
|
}
|
|
699
|
+
interface PassportOverrides {
|
|
700
|
+
network: Networks;
|
|
701
|
+
authenticationDomain: string;
|
|
702
|
+
magicPublishableApiKey: string;
|
|
703
|
+
magicProviderId: string;
|
|
704
|
+
passportDomain: string;
|
|
705
|
+
imxApiBasePath: string;
|
|
706
|
+
}
|
|
707
|
+
interface PassportModuleConfiguration extends ModuleConfiguration<PassportOverrides>, OidcConfiguration {
|
|
708
|
+
}
|
|
690
709
|
|
|
691
710
|
declare class Passport {
|
|
692
711
|
private authManager;
|
|
693
712
|
private magicAdapter;
|
|
694
713
|
private readonly config;
|
|
695
|
-
constructor(
|
|
714
|
+
constructor(passportModuleConfiguration: PassportModuleConfiguration);
|
|
696
715
|
connectImx(): Promise<IMXProvider>;
|
|
697
716
|
loginCallback(): Promise<void>;
|
|
698
717
|
logout(): Promise<void>;
|
|
@@ -702,9 +721,16 @@ declare class Passport {
|
|
|
702
721
|
private registerUser;
|
|
703
722
|
}
|
|
704
723
|
|
|
705
|
-
declare
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
724
|
+
declare class PassportConfiguration {
|
|
725
|
+
readonly network: Networks;
|
|
726
|
+
readonly authenticationDomain: string;
|
|
727
|
+
readonly passportDomain: string;
|
|
728
|
+
readonly magicPublishableApiKey: string;
|
|
729
|
+
readonly magicProviderId: string;
|
|
730
|
+
readonly imxApiBasePath: string;
|
|
731
|
+
readonly oidcConfiguration: OidcConfiguration;
|
|
732
|
+
readonly baseConfig: ImmutableConfiguration;
|
|
733
|
+
constructor({ baseConfig, overrides, ...oidcConfiguration }: PassportModuleConfiguration);
|
|
734
|
+
}
|
|
709
735
|
|
|
710
|
-
export {
|
|
736
|
+
export { Passport, PassportConfiguration, PassportError };
|
package/dist/passport.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
+
import { Configuration, UsersApi, TransfersApi, OrdersApi, ExchangesApi, TradesApi, generateLegacyStarkPrivateKey, createStarkSigner } from '@imtbl/core-sdk';
|
|
1
2
|
import { UserManager } from 'oidc-client-ts';
|
|
2
3
|
import { ethers } from 'ethers';
|
|
3
4
|
import { Magic } from 'magic-sdk';
|
|
4
5
|
import { OpenIdExtension } from '@magic-ext/oidc';
|
|
5
|
-
import { Configuration, UsersApi, TransfersApi, OrdersApi, ExchangesApi, TradesApi, generateLegacyStarkPrivateKey, createStarkSigner } from '@imtbl/core-sdk';
|
|
6
6
|
import BN from 'bn.js';
|
|
7
7
|
import * as encUtils from 'enc-utils';
|
|
8
8
|
|
|
@@ -67,6 +67,12 @@ function convertToSignableToken(token) {
|
|
|
67
67
|
}
|
|
68
68
|
}
|
|
69
69
|
|
|
70
|
+
var Environment;
|
|
71
|
+
(function (Environment) {
|
|
72
|
+
Environment["PRODUCTION"] = "production";
|
|
73
|
+
Environment["SANDBOX"] = "sandbox";
|
|
74
|
+
})(Environment || (Environment = {}));
|
|
75
|
+
|
|
70
76
|
var PassportErrorType;
|
|
71
77
|
(function (PassportErrorType) {
|
|
72
78
|
PassportErrorType["AUTHENTICATION_ERROR"] = "AUTHENTICATION_ERROR";
|
|
@@ -119,17 +125,17 @@ const retryWithDelay = async (fn, options) => {
|
|
|
119
125
|
}
|
|
120
126
|
};
|
|
121
127
|
|
|
122
|
-
const getAuthConfiguration = ({ oidcConfiguration, }) => {
|
|
128
|
+
const getAuthConfiguration = ({ oidcConfiguration, authenticationDomain, }) => {
|
|
123
129
|
const baseConfiguration = {
|
|
124
|
-
authority:
|
|
130
|
+
authority: authenticationDomain,
|
|
125
131
|
redirect_uri: oidcConfiguration.redirectUri,
|
|
126
132
|
popup_redirect_uri: oidcConfiguration.redirectUri,
|
|
127
133
|
client_id: oidcConfiguration.clientId,
|
|
128
134
|
metadata: {
|
|
129
|
-
authorization_endpoint: `${
|
|
130
|
-
token_endpoint: `${
|
|
131
|
-
userinfo_endpoint: `${
|
|
132
|
-
end_session_endpoint: `${
|
|
135
|
+
authorization_endpoint: `${authenticationDomain}/authorize`,
|
|
136
|
+
token_endpoint: `${authenticationDomain}/oauth/token`,
|
|
137
|
+
userinfo_endpoint: `${authenticationDomain}/userinfo`,
|
|
138
|
+
end_session_endpoint: `${authenticationDomain}/v2/logout` +
|
|
133
139
|
`?returnTo=${encodeURIComponent(oidcConfiguration.logoutRedirectUri)}` +
|
|
134
140
|
`&client_id=${oidcConfiguration.clientId}`,
|
|
135
141
|
},
|
|
@@ -167,7 +173,10 @@ class AuthManager {
|
|
|
167
173
|
};
|
|
168
174
|
async login() {
|
|
169
175
|
return withPassportError(async () => {
|
|
170
|
-
const
|
|
176
|
+
const popupWindowFeatures = { width: 400, height: 420 };
|
|
177
|
+
const oidcUser = await this.userManager.signinPopup({
|
|
178
|
+
popupWindowFeatures,
|
|
179
|
+
});
|
|
171
180
|
return this.mapOidcUserToDomainModel(oidcUser);
|
|
172
181
|
}, PassportErrorType.AUTHENTICATION_ERROR);
|
|
173
182
|
}
|
|
@@ -250,26 +259,12 @@ var TransactionTypes;
|
|
|
250
259
|
const PassportEventType = 'imx_passport_confirmation';
|
|
251
260
|
|
|
252
261
|
const openPopupCenter = ({ url, title, width, height, }) => {
|
|
253
|
-
|
|
254
|
-
const
|
|
255
|
-
const dualScreenTop = window.screenTop !== undefined ? window.screenTop : window.screenY;
|
|
256
|
-
const windowWidth = window.innerWidth
|
|
257
|
-
? window.innerWidth
|
|
258
|
-
: document.documentElement.clientWidth
|
|
259
|
-
? document.documentElement.clientWidth
|
|
260
|
-
: screen.width;
|
|
261
|
-
const windowHeight = window.innerHeight
|
|
262
|
-
? window.innerHeight
|
|
263
|
-
: document.documentElement.clientHeight
|
|
264
|
-
? document.documentElement.clientHeight
|
|
265
|
-
: screen.height;
|
|
266
|
-
const systemZoom = windowWidth / window.screen.availWidth;
|
|
267
|
-
const left = (windowWidth - width) / 2 / systemZoom + dualScreenLeft;
|
|
268
|
-
const top = (windowHeight - height) / 2 / systemZoom + dualScreenTop;
|
|
262
|
+
const left = Math.max(0, Math.round(window.screenX + (window.outerWidth - width) / 2));
|
|
263
|
+
const top = Math.max(0, Math.round(window.screenY + (window.outerHeight - height) / 2));
|
|
269
264
|
const newWindow = window.open(url, title, `
|
|
270
265
|
scrollbars=yes,
|
|
271
|
-
width=${width
|
|
272
|
-
height=${height
|
|
266
|
+
width=${width},
|
|
267
|
+
height=${height},
|
|
273
268
|
top=${top},
|
|
274
269
|
left=${left}
|
|
275
270
|
`);
|
|
@@ -281,8 +276,8 @@ const openPopupCenter = ({ url, title, width, height, }) => {
|
|
|
281
276
|
};
|
|
282
277
|
|
|
283
278
|
const ConfirmationWindowTitle = 'Confirm this transaction';
|
|
284
|
-
const ConfirmationWindowHeight =
|
|
285
|
-
const ConfirmationWindowWidth =
|
|
279
|
+
const ConfirmationWindowHeight = 380;
|
|
280
|
+
const ConfirmationWindowWidth = 480;
|
|
286
281
|
const ConfirmationWindowClosedPollingDuration = 1000;
|
|
287
282
|
class ConfirmationScreen {
|
|
288
283
|
config;
|
|
@@ -296,7 +291,7 @@ class ConfirmationScreen {
|
|
|
296
291
|
...message,
|
|
297
292
|
}, this.config.passportDomain);
|
|
298
293
|
}
|
|
299
|
-
startTransaction(accessToken, transaction) {
|
|
294
|
+
startTransaction(accessToken, transaction, popupOptions) {
|
|
300
295
|
return new Promise((resolve, reject) => {
|
|
301
296
|
const messageHandler = ({ data, origin }) => {
|
|
302
297
|
if (origin != this.config.passportDomain ||
|
|
@@ -327,8 +322,8 @@ class ConfirmationScreen {
|
|
|
327
322
|
const confirmationWindow = openPopupCenter({
|
|
328
323
|
url: `${this.config.passportDomain}/transaction-confirmation`,
|
|
329
324
|
title: ConfirmationWindowTitle,
|
|
330
|
-
width: ConfirmationWindowWidth,
|
|
331
|
-
height: ConfirmationWindowHeight,
|
|
325
|
+
width: popupOptions?.width || ConfirmationWindowWidth,
|
|
326
|
+
height: popupOptions?.height || ConfirmationWindowHeight,
|
|
332
327
|
});
|
|
333
328
|
// https://stackoverflow.com/questions/9388380/capture-the-close-event-of-popup-window-in-javascript/48240128#48240128
|
|
334
329
|
const timer = setInterval(function () {
|
|
@@ -415,10 +410,11 @@ async function batchNftTransfer({ user, starkSigner, request, transfersApi, pass
|
|
|
415
410
|
getSignableTransferRequestV2,
|
|
416
411
|
});
|
|
417
412
|
const confirmationScreen = new ConfirmationScreen(passportConfig);
|
|
413
|
+
const popupWindowSize = { width: 480, height: 784 };
|
|
418
414
|
const confirmationResult = await confirmationScreen.startTransaction(user.accessToken, {
|
|
419
415
|
transactionType: TransactionTypes.CreateBatchTransfer,
|
|
420
416
|
transactionData: getSignableTransferRequestV2,
|
|
421
|
-
});
|
|
417
|
+
}, popupWindowSize);
|
|
422
418
|
if (!confirmationResult.confirmed) {
|
|
423
419
|
throw new Error('Transaction rejected by user');
|
|
424
420
|
}
|
|
@@ -627,7 +623,7 @@ async function createTrade({ request, tradesApi, user, starkSigner, passportConf
|
|
|
627
623
|
},
|
|
628
624
|
};
|
|
629
625
|
const headers = { Authorization: 'Bearer ' + user.accessToken };
|
|
630
|
-
const { data: createTradeResponse } = await tradesApi.
|
|
626
|
+
const { data: createTradeResponse } = await tradesApi.createTradeV3(tradeParams, {
|
|
631
627
|
headers,
|
|
632
628
|
});
|
|
633
629
|
return createTradeResponse;
|
|
@@ -647,7 +643,7 @@ class PassportImxProvider {
|
|
|
647
643
|
this.starkSigner = starkSigner;
|
|
648
644
|
this.passportConfig = passportConfig;
|
|
649
645
|
const apiConfig = new Configuration({
|
|
650
|
-
basePath: passportConfig.
|
|
646
|
+
basePath: passportConfig.imxApiBasePath,
|
|
651
647
|
});
|
|
652
648
|
this.transfersApi = new TransfersApi(apiConfig);
|
|
653
649
|
this.ordersApi = new OrdersApi(apiConfig);
|
|
@@ -739,67 +735,75 @@ var Networks;
|
|
|
739
735
|
Networks["SANDBOX"] = "goerli";
|
|
740
736
|
})(Networks || (Networks = {}));
|
|
741
737
|
|
|
742
|
-
const
|
|
743
|
-
PRODUCTION: {
|
|
744
|
-
network: Networks.PRODUCTION,
|
|
745
|
-
authenticationDomain: 'https://auth.immutable.com',
|
|
746
|
-
magicPublishableApiKey: 'pk_live_10F423798A540ED7',
|
|
747
|
-
magicProviderId: 'fSMzaRQ4O7p4fttl7pCyGVtJS_G70P8SNsLXtPPGHo0=',
|
|
748
|
-
baseIMXApiPath: 'https://api.x.immutable.com',
|
|
749
|
-
passportDomain: 'https://passport.immutable.com',
|
|
750
|
-
},
|
|
751
|
-
SANDBOX: {
|
|
752
|
-
network: Networks.SANDBOX,
|
|
753
|
-
authenticationDomain: 'https://auth.immutable.com',
|
|
754
|
-
magicPublishableApiKey: 'pk_live_10F423798A540ED7',
|
|
755
|
-
magicProviderId: 'fSMzaRQ4O7p4fttl7pCyGVtJS_G70P8SNsLXtPPGHo0=',
|
|
756
|
-
baseIMXApiPath: 'https://api.sandbox.x.immutable.com',
|
|
757
|
-
passportDomain: 'https://passport.sandbox.immutable.com',
|
|
758
|
-
},
|
|
759
|
-
};
|
|
760
|
-
const validateConfiguration = (configurationName, configuration, requiredKeys) => {
|
|
761
|
-
if (!configuration) {
|
|
762
|
-
throw new PassportError(`${configurationName} cannot be null`, PassportErrorType.INVALID_CONFIGURATION);
|
|
763
|
-
}
|
|
738
|
+
const validateConfiguration = (configuration, requiredKeys, prefix) => {
|
|
764
739
|
const missingKeys = requiredKeys
|
|
765
740
|
.map((key) => !configuration[key] && key)
|
|
766
741
|
.filter((n) => n)
|
|
767
742
|
.join(', ');
|
|
768
743
|
if (missingKeys !== '') {
|
|
769
|
-
|
|
744
|
+
const errorMessage = prefix
|
|
745
|
+
? `${prefix} - ${missingKeys} cannot be null`
|
|
746
|
+
: `${missingKeys} cannot be null`;
|
|
747
|
+
throw new PassportError(errorMessage, PassportErrorType.INVALID_CONFIGURATION);
|
|
770
748
|
}
|
|
771
749
|
};
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
oidcConfiguration
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
750
|
+
class PassportConfiguration {
|
|
751
|
+
network;
|
|
752
|
+
authenticationDomain;
|
|
753
|
+
passportDomain;
|
|
754
|
+
magicPublishableApiKey;
|
|
755
|
+
magicProviderId;
|
|
756
|
+
imxApiBasePath;
|
|
757
|
+
oidcConfiguration;
|
|
758
|
+
baseConfig;
|
|
759
|
+
constructor({ baseConfig, overrides, ...oidcConfiguration }) {
|
|
760
|
+
validateConfiguration(oidcConfiguration, [
|
|
761
|
+
'clientId',
|
|
762
|
+
'logoutRedirectUri',
|
|
763
|
+
'redirectUri',
|
|
764
|
+
]);
|
|
765
|
+
this.oidcConfiguration = oidcConfiguration;
|
|
766
|
+
this.baseConfig = baseConfig;
|
|
767
|
+
if (overrides) {
|
|
768
|
+
validateConfiguration(overrides, [
|
|
769
|
+
'network',
|
|
770
|
+
'authenticationDomain',
|
|
771
|
+
'magicPublishableApiKey',
|
|
772
|
+
'magicProviderId',
|
|
773
|
+
'passportDomain',
|
|
774
|
+
'imxApiBasePath',
|
|
775
|
+
], 'overrides');
|
|
776
|
+
this.network = overrides.network;
|
|
777
|
+
this.authenticationDomain = overrides.authenticationDomain;
|
|
778
|
+
this.passportDomain = overrides.passportDomain;
|
|
779
|
+
this.magicPublishableApiKey = overrides.magicPublishableApiKey;
|
|
780
|
+
this.magicProviderId = overrides.magicProviderId;
|
|
781
|
+
this.imxApiBasePath = overrides.imxApiBasePath;
|
|
782
|
+
}
|
|
783
|
+
else {
|
|
784
|
+
switch (baseConfig.environment) {
|
|
785
|
+
case Environment.SANDBOX: {
|
|
786
|
+
this.network = Networks.SANDBOX;
|
|
787
|
+
this.authenticationDomain = 'https://auth.immutable.com';
|
|
788
|
+
this.magicPublishableApiKey = 'pk_live_10F423798A540ED7';
|
|
789
|
+
this.magicProviderId = 'fSMzaRQ4O7p4fttl7pCyGVtJS_G70P8SNsLXtPPGHo0=';
|
|
790
|
+
this.passportDomain = 'https://passport.sandbox.immutable.com';
|
|
791
|
+
this.imxApiBasePath = 'https://api.sandbox.x.immutable.com';
|
|
792
|
+
break;
|
|
793
|
+
}
|
|
794
|
+
case Environment.PRODUCTION: {
|
|
795
|
+
this.network = Networks.PRODUCTION;
|
|
796
|
+
this.authenticationDomain = 'https://auth.immutable.com';
|
|
797
|
+
this.magicPublishableApiKey = 'pk_live_10F423798A540ED7';
|
|
798
|
+
this.magicProviderId = 'fSMzaRQ4O7p4fttl7pCyGVtJS_G70P8SNsLXtPPGHo0=';
|
|
799
|
+
this.passportDomain = 'https://passport.immutable.com';
|
|
800
|
+
this.imxApiBasePath = 'https://api.x.immutable.com';
|
|
801
|
+
break;
|
|
802
|
+
}
|
|
803
|
+
}
|
|
804
|
+
}
|
|
805
|
+
}
|
|
806
|
+
}
|
|
803
807
|
|
|
804
808
|
const getStarkSigner = async (signer) => {
|
|
805
809
|
return withPassportError(async () => {
|
|
@@ -838,8 +842,8 @@ class Passport {
|
|
|
838
842
|
authManager;
|
|
839
843
|
magicAdapter;
|
|
840
844
|
config;
|
|
841
|
-
constructor(
|
|
842
|
-
const passportConfiguration =
|
|
845
|
+
constructor(passportModuleConfiguration) {
|
|
846
|
+
const passportConfiguration = new PassportConfiguration(passportModuleConfiguration);
|
|
843
847
|
this.config = passportConfiguration;
|
|
844
848
|
this.authManager = new AuthManager(this.config);
|
|
845
849
|
this.magicAdapter = new MagicAdapter(this.config);
|
|
@@ -887,7 +891,7 @@ class Passport {
|
|
|
887
891
|
}
|
|
888
892
|
async registerUser(userAdminKeySigner, starkSigner, jwt) {
|
|
889
893
|
const configuration = new Configuration({
|
|
890
|
-
basePath: this.config.
|
|
894
|
+
basePath: this.config.imxApiBasePath,
|
|
891
895
|
});
|
|
892
896
|
const usersApi = new UsersApi(configuration);
|
|
893
897
|
await registerPassport({
|
|
@@ -903,4 +907,4 @@ class Passport {
|
|
|
903
907
|
}
|
|
904
908
|
}
|
|
905
909
|
|
|
906
|
-
export {
|
|
910
|
+
export { Passport, PassportConfiguration, PassportError };
|
package/dist/provider.d.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { ProviderConfiguration as ProviderConfiguration$1 } from 'config';
|
|
2
|
+
|
|
1
3
|
declare type Bytes = ArrayLike<number>;
|
|
2
4
|
declare type BytesLike = Bytes | string;
|
|
3
5
|
interface Hexable {
|
|
@@ -329,7 +331,7 @@ interface ConfigurationParameters {
|
|
|
329
331
|
baseOptions?: any;
|
|
330
332
|
formDataCtor?: new () => any;
|
|
331
333
|
}
|
|
332
|
-
declare class Configuration
|
|
334
|
+
declare class Configuration {
|
|
333
335
|
/**
|
|
334
336
|
* parameter for apiKey security
|
|
335
337
|
* @param name security name
|
|
@@ -811,7 +813,7 @@ interface ImmutableXConfiguration {
|
|
|
811
813
|
/**
|
|
812
814
|
* The configuration for the API client
|
|
813
815
|
*/
|
|
814
|
-
apiConfiguration: Configuration
|
|
816
|
+
apiConfiguration: Configuration;
|
|
815
817
|
/**
|
|
816
818
|
* The configuration for the Ethereum network
|
|
817
819
|
*/
|
|
@@ -903,24 +905,10 @@ interface IMXProvider {
|
|
|
903
905
|
completeWithdrawal(starkPublicKey: string, token: AnyToken): Promise<TransactionResponse>;
|
|
904
906
|
}
|
|
905
907
|
|
|
906
|
-
declare enum Environment {
|
|
907
|
-
DEVELOPMENT = "development",
|
|
908
|
-
SANDBOX = "sandbox",
|
|
909
|
-
PRODUCTION = "production"
|
|
910
|
-
}
|
|
911
|
-
type StarkExConfig = ImmutableXConfiguration & {
|
|
912
|
-
env: Environment;
|
|
913
|
-
};
|
|
914
|
-
declare class Configuration {
|
|
915
|
-
private readonly starkExConfig;
|
|
916
|
-
constructor(config: StarkExConfig);
|
|
917
|
-
getStarkExConfig(): StarkExConfig;
|
|
918
|
-
}
|
|
919
|
-
|
|
920
908
|
declare class GenericIMXProvider implements IMXProvider {
|
|
921
909
|
private readonly config;
|
|
922
910
|
private readonly signers;
|
|
923
|
-
constructor(config:
|
|
911
|
+
constructor(config: ProviderConfiguration$1, ethSigner: Signer, starkExSigner: StarkSigner);
|
|
924
912
|
getAddress(): Promise<string>;
|
|
925
913
|
registerOffchain(): Promise<RegisterUserResponse>;
|
|
926
914
|
batchNftTransfer(request: Array<NftTransferDetails>): Promise<CreateTransferResponse>;
|
|
@@ -937,10 +925,38 @@ declare class GenericIMXProvider implements IMXProvider {
|
|
|
937
925
|
|
|
938
926
|
declare class MetaMaskIMXProvider extends GenericIMXProvider {
|
|
939
927
|
private static imxSigner;
|
|
940
|
-
constructor(config:
|
|
941
|
-
static connect(config:
|
|
928
|
+
constructor(config: ProviderConfiguration$1, ethSigner: Signer, starkExSigner: StarkSigner);
|
|
929
|
+
static connect(config: ProviderConfiguration$1): Promise<MetaMaskIMXProvider>;
|
|
942
930
|
static disconnect(): Promise<void>;
|
|
943
931
|
static signMessage(message: string): Promise<string>;
|
|
944
932
|
}
|
|
945
933
|
|
|
946
|
-
|
|
934
|
+
declare enum Environment {
|
|
935
|
+
PRODUCTION = "production",
|
|
936
|
+
SANDBOX = "sandbox"
|
|
937
|
+
}
|
|
938
|
+
declare class ImmutableConfiguration {
|
|
939
|
+
readonly environment: Environment;
|
|
940
|
+
readonly apiKey?: string;
|
|
941
|
+
constructor(options: {
|
|
942
|
+
environment: Environment;
|
|
943
|
+
apiKey?: string;
|
|
944
|
+
});
|
|
945
|
+
}
|
|
946
|
+
interface ModuleConfiguration<T> {
|
|
947
|
+
baseConfig: ImmutableConfiguration;
|
|
948
|
+
overrides?: T;
|
|
949
|
+
}
|
|
950
|
+
|
|
951
|
+
interface ProviderOverrides {
|
|
952
|
+
immutableXConfig: ImmutableXConfiguration;
|
|
953
|
+
}
|
|
954
|
+
interface ProviderModuleConfiguration extends ModuleConfiguration<ProviderOverrides> {
|
|
955
|
+
}
|
|
956
|
+
declare class ProviderConfiguration {
|
|
957
|
+
readonly immutableXConfig: ImmutableXConfiguration;
|
|
958
|
+
readonly baseConfig: ImmutableConfiguration;
|
|
959
|
+
constructor({ baseConfig, overrides }: ProviderModuleConfiguration);
|
|
960
|
+
}
|
|
961
|
+
|
|
962
|
+
export { GenericIMXProvider, IMXProvider, MetaMaskIMXProvider, ProviderConfiguration };
|