@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/passport.d.ts
CHANGED
|
@@ -663,23 +663,6 @@ 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
|
-
|
|
683
666
|
type UserProfile = {
|
|
684
667
|
email?: string;
|
|
685
668
|
nickname?: string;
|
|
@@ -689,29 +672,27 @@ declare enum Networks {
|
|
|
689
672
|
PRODUCTION = "mainnet",
|
|
690
673
|
SANDBOX = "goerli"
|
|
691
674
|
}
|
|
692
|
-
interface
|
|
693
|
-
clientId: string;
|
|
694
|
-
logoutRedirectUri: string;
|
|
695
|
-
redirectUri: string;
|
|
696
|
-
scope?: string;
|
|
697
|
-
audience?: string;
|
|
698
|
-
}
|
|
699
|
-
interface PassportOverrides {
|
|
675
|
+
interface EnvironmentConfiguration {
|
|
700
676
|
network: Networks;
|
|
701
677
|
authenticationDomain: string;
|
|
702
678
|
magicPublishableApiKey: string;
|
|
703
679
|
magicProviderId: string;
|
|
680
|
+
baseIMXApiPath: string;
|
|
704
681
|
passportDomain: string;
|
|
705
|
-
imxApiBasePath: string;
|
|
706
682
|
}
|
|
707
|
-
interface
|
|
683
|
+
interface OidcConfiguration {
|
|
684
|
+
clientId: string;
|
|
685
|
+
logoutRedirectUri: string;
|
|
686
|
+
redirectUri: string;
|
|
687
|
+
scope?: string;
|
|
688
|
+
audience?: string;
|
|
708
689
|
}
|
|
709
690
|
|
|
710
691
|
declare class Passport {
|
|
711
692
|
private authManager;
|
|
712
693
|
private magicAdapter;
|
|
713
694
|
private readonly config;
|
|
714
|
-
constructor(
|
|
695
|
+
constructor(environmentConfiguration: EnvironmentConfiguration, oidcConfiguration: OidcConfiguration);
|
|
715
696
|
connectImx(): Promise<IMXProvider>;
|
|
716
697
|
loginCallback(): Promise<void>;
|
|
717
698
|
logout(): Promise<void>;
|
|
@@ -721,16 +702,9 @@ declare class Passport {
|
|
|
721
702
|
private registerUser;
|
|
722
703
|
}
|
|
723
704
|
|
|
724
|
-
declare
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
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
|
-
}
|
|
705
|
+
declare const Config: {
|
|
706
|
+
PRODUCTION: EnvironmentConfiguration;
|
|
707
|
+
SANDBOX: EnvironmentConfiguration;
|
|
708
|
+
};
|
|
735
709
|
|
|
736
|
-
export {
|
|
710
|
+
export { Config, Passport, PassportError };
|
package/dist/passport.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { Configuration, UsersApi, TransfersApi, OrdersApi, ExchangesApi, TradesApi, generateLegacyStarkPrivateKey, createStarkSigner } from '@imtbl/core-sdk';
|
|
2
1
|
import { UserManager } from 'oidc-client-ts';
|
|
3
2
|
import { ethers } from 'ethers';
|
|
4
3
|
import { Magic } from 'magic-sdk';
|
|
5
4
|
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,12 +67,6 @@ 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
|
-
|
|
76
70
|
var PassportErrorType;
|
|
77
71
|
(function (PassportErrorType) {
|
|
78
72
|
PassportErrorType["AUTHENTICATION_ERROR"] = "AUTHENTICATION_ERROR";
|
|
@@ -125,17 +119,17 @@ const retryWithDelay = async (fn, options) => {
|
|
|
125
119
|
}
|
|
126
120
|
};
|
|
127
121
|
|
|
128
|
-
const getAuthConfiguration = ({ oidcConfiguration,
|
|
122
|
+
const getAuthConfiguration = ({ oidcConfiguration, }) => {
|
|
129
123
|
const baseConfiguration = {
|
|
130
|
-
authority: authenticationDomain,
|
|
124
|
+
authority: oidcConfiguration.authenticationDomain,
|
|
131
125
|
redirect_uri: oidcConfiguration.redirectUri,
|
|
132
126
|
popup_redirect_uri: oidcConfiguration.redirectUri,
|
|
133
127
|
client_id: oidcConfiguration.clientId,
|
|
134
128
|
metadata: {
|
|
135
|
-
authorization_endpoint: `${authenticationDomain}/authorize`,
|
|
136
|
-
token_endpoint: `${authenticationDomain}/oauth/token`,
|
|
137
|
-
userinfo_endpoint: `${authenticationDomain}/userinfo`,
|
|
138
|
-
end_session_endpoint: `${authenticationDomain}/v2/logout` +
|
|
129
|
+
authorization_endpoint: `${oidcConfiguration.authenticationDomain}/authorize`,
|
|
130
|
+
token_endpoint: `${oidcConfiguration.authenticationDomain}/oauth/token`,
|
|
131
|
+
userinfo_endpoint: `${oidcConfiguration.authenticationDomain}/userinfo`,
|
|
132
|
+
end_session_endpoint: `${oidcConfiguration.authenticationDomain}/v2/logout` +
|
|
139
133
|
`?returnTo=${encodeURIComponent(oidcConfiguration.logoutRedirectUri)}` +
|
|
140
134
|
`&client_id=${oidcConfiguration.clientId}`,
|
|
141
135
|
},
|
|
@@ -173,10 +167,7 @@ class AuthManager {
|
|
|
173
167
|
};
|
|
174
168
|
async login() {
|
|
175
169
|
return withPassportError(async () => {
|
|
176
|
-
const
|
|
177
|
-
const oidcUser = await this.userManager.signinPopup({
|
|
178
|
-
popupWindowFeatures,
|
|
179
|
-
});
|
|
170
|
+
const oidcUser = await this.userManager.signinPopup();
|
|
180
171
|
return this.mapOidcUserToDomainModel(oidcUser);
|
|
181
172
|
}, PassportErrorType.AUTHENTICATION_ERROR);
|
|
182
173
|
}
|
|
@@ -259,12 +250,26 @@ var TransactionTypes;
|
|
|
259
250
|
const PassportEventType = 'imx_passport_confirmation';
|
|
260
251
|
|
|
261
252
|
const openPopupCenter = ({ url, title, width, height, }) => {
|
|
262
|
-
|
|
263
|
-
const
|
|
253
|
+
// Fixes dual-screen position Most browsers Firefox
|
|
254
|
+
const dualScreenLeft = window.screenLeft !== undefined ? window.screenLeft : window.screenX;
|
|
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;
|
|
264
269
|
const newWindow = window.open(url, title, `
|
|
265
270
|
scrollbars=yes,
|
|
266
|
-
width=${width},
|
|
267
|
-
height=${height},
|
|
271
|
+
width=${width / systemZoom},
|
|
272
|
+
height=${height / systemZoom},
|
|
268
273
|
top=${top},
|
|
269
274
|
left=${left}
|
|
270
275
|
`);
|
|
@@ -276,8 +281,8 @@ const openPopupCenter = ({ url, title, width, height, }) => {
|
|
|
276
281
|
};
|
|
277
282
|
|
|
278
283
|
const ConfirmationWindowTitle = 'Confirm this transaction';
|
|
279
|
-
const ConfirmationWindowHeight =
|
|
280
|
-
const ConfirmationWindowWidth =
|
|
284
|
+
const ConfirmationWindowHeight = 600;
|
|
285
|
+
const ConfirmationWindowWidth = 600;
|
|
281
286
|
const ConfirmationWindowClosedPollingDuration = 1000;
|
|
282
287
|
class ConfirmationScreen {
|
|
283
288
|
config;
|
|
@@ -291,7 +296,7 @@ class ConfirmationScreen {
|
|
|
291
296
|
...message,
|
|
292
297
|
}, this.config.passportDomain);
|
|
293
298
|
}
|
|
294
|
-
startTransaction(accessToken, transaction
|
|
299
|
+
startTransaction(accessToken, transaction) {
|
|
295
300
|
return new Promise((resolve, reject) => {
|
|
296
301
|
const messageHandler = ({ data, origin }) => {
|
|
297
302
|
if (origin != this.config.passportDomain ||
|
|
@@ -322,8 +327,8 @@ class ConfirmationScreen {
|
|
|
322
327
|
const confirmationWindow = openPopupCenter({
|
|
323
328
|
url: `${this.config.passportDomain}/transaction-confirmation`,
|
|
324
329
|
title: ConfirmationWindowTitle,
|
|
325
|
-
width:
|
|
326
|
-
height:
|
|
330
|
+
width: ConfirmationWindowWidth,
|
|
331
|
+
height: ConfirmationWindowHeight,
|
|
327
332
|
});
|
|
328
333
|
// https://stackoverflow.com/questions/9388380/capture-the-close-event-of-popup-window-in-javascript/48240128#48240128
|
|
329
334
|
const timer = setInterval(function () {
|
|
@@ -410,11 +415,10 @@ async function batchNftTransfer({ user, starkSigner, request, transfersApi, pass
|
|
|
410
415
|
getSignableTransferRequestV2,
|
|
411
416
|
});
|
|
412
417
|
const confirmationScreen = new ConfirmationScreen(passportConfig);
|
|
413
|
-
const popupWindowSize = { width: 480, height: 784 };
|
|
414
418
|
const confirmationResult = await confirmationScreen.startTransaction(user.accessToken, {
|
|
415
419
|
transactionType: TransactionTypes.CreateBatchTransfer,
|
|
416
420
|
transactionData: getSignableTransferRequestV2,
|
|
417
|
-
}
|
|
421
|
+
});
|
|
418
422
|
if (!confirmationResult.confirmed) {
|
|
419
423
|
throw new Error('Transaction rejected by user');
|
|
420
424
|
}
|
|
@@ -643,7 +647,7 @@ class PassportImxProvider {
|
|
|
643
647
|
this.starkSigner = starkSigner;
|
|
644
648
|
this.passportConfig = passportConfig;
|
|
645
649
|
const apiConfig = new Configuration({
|
|
646
|
-
basePath: passportConfig.
|
|
650
|
+
basePath: passportConfig.imxAPIConfiguration.basePath,
|
|
647
651
|
});
|
|
648
652
|
this.transfersApi = new TransfersApi(apiConfig);
|
|
649
653
|
this.ordersApi = new OrdersApi(apiConfig);
|
|
@@ -735,75 +739,67 @@ var Networks;
|
|
|
735
739
|
Networks["SANDBOX"] = "goerli";
|
|
736
740
|
})(Networks || (Networks = {}));
|
|
737
741
|
|
|
738
|
-
const
|
|
742
|
+
const Config = {
|
|
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
|
+
}
|
|
739
764
|
const missingKeys = requiredKeys
|
|
740
765
|
.map((key) => !configuration[key] && key)
|
|
741
766
|
.filter((n) => n)
|
|
742
767
|
.join(', ');
|
|
743
768
|
if (missingKeys !== '') {
|
|
744
|
-
|
|
745
|
-
? `${prefix} - ${missingKeys} cannot be null`
|
|
746
|
-
: `${missingKeys} cannot be null`;
|
|
747
|
-
throw new PassportError(errorMessage, PassportErrorType.INVALID_CONFIGURATION);
|
|
769
|
+
throw new PassportError(`${configurationName} - ${missingKeys} cannot be null`, PassportErrorType.INVALID_CONFIGURATION);
|
|
748
770
|
}
|
|
749
771
|
};
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
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.immutable.com';
|
|
791
|
-
this.imxApiBasePath = 'https://api.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.sandbox.immutable.com';
|
|
800
|
-
this.imxApiBasePath = 'https://api.sandbox.x.immutable.com';
|
|
801
|
-
break;
|
|
802
|
-
}
|
|
803
|
-
}
|
|
804
|
-
}
|
|
805
|
-
}
|
|
806
|
-
}
|
|
772
|
+
const getPassportConfiguration = (environmentConfiguration, oidcConfiguration) => {
|
|
773
|
+
validateConfiguration('EnvironmentConfiguration', environmentConfiguration, [
|
|
774
|
+
'network',
|
|
775
|
+
'authenticationDomain',
|
|
776
|
+
'magicPublishableApiKey',
|
|
777
|
+
'magicProviderId',
|
|
778
|
+
'passportDomain',
|
|
779
|
+
]);
|
|
780
|
+
validateConfiguration('OidcConfiguration', oidcConfiguration, [
|
|
781
|
+
'clientId',
|
|
782
|
+
'logoutRedirectUri',
|
|
783
|
+
'redirectUri',
|
|
784
|
+
]);
|
|
785
|
+
return {
|
|
786
|
+
network: environmentConfiguration.network,
|
|
787
|
+
oidcConfiguration: {
|
|
788
|
+
authenticationDomain: environmentConfiguration.authenticationDomain,
|
|
789
|
+
clientId: oidcConfiguration.clientId,
|
|
790
|
+
logoutRedirectUri: oidcConfiguration.logoutRedirectUri,
|
|
791
|
+
redirectUri: oidcConfiguration.redirectUri,
|
|
792
|
+
scope: oidcConfiguration.scope,
|
|
793
|
+
audience: oidcConfiguration.audience,
|
|
794
|
+
},
|
|
795
|
+
imxAPIConfiguration: {
|
|
796
|
+
basePath: environmentConfiguration.baseIMXApiPath,
|
|
797
|
+
},
|
|
798
|
+
passportDomain: environmentConfiguration.passportDomain,
|
|
799
|
+
magicPublishableApiKey: environmentConfiguration.magicPublishableApiKey,
|
|
800
|
+
magicProviderId: environmentConfiguration.magicProviderId,
|
|
801
|
+
};
|
|
802
|
+
};
|
|
807
803
|
|
|
808
804
|
const getStarkSigner = async (signer) => {
|
|
809
805
|
return withPassportError(async () => {
|
|
@@ -842,8 +838,8 @@ class Passport {
|
|
|
842
838
|
authManager;
|
|
843
839
|
magicAdapter;
|
|
844
840
|
config;
|
|
845
|
-
constructor(
|
|
846
|
-
const passportConfiguration =
|
|
841
|
+
constructor(environmentConfiguration, oidcConfiguration) {
|
|
842
|
+
const passportConfiguration = getPassportConfiguration(environmentConfiguration, oidcConfiguration);
|
|
847
843
|
this.config = passportConfiguration;
|
|
848
844
|
this.authManager = new AuthManager(this.config);
|
|
849
845
|
this.magicAdapter = new MagicAdapter(this.config);
|
|
@@ -891,7 +887,7 @@ class Passport {
|
|
|
891
887
|
}
|
|
892
888
|
async registerUser(userAdminKeySigner, starkSigner, jwt) {
|
|
893
889
|
const configuration = new Configuration({
|
|
894
|
-
basePath: this.config.
|
|
890
|
+
basePath: this.config.imxAPIConfiguration.basePath,
|
|
895
891
|
});
|
|
896
892
|
const usersApi = new UsersApi(configuration);
|
|
897
893
|
await registerPassport({
|
|
@@ -907,4 +903,4 @@ class Passport {
|
|
|
907
903
|
}
|
|
908
904
|
}
|
|
909
905
|
|
|
910
|
-
export {
|
|
906
|
+
export { Config, Passport, PassportError };
|
package/dist/provider.d.ts
CHANGED
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import { ProviderConfiguration as ProviderConfiguration$1 } from 'config';
|
|
2
|
-
|
|
3
1
|
declare type Bytes = ArrayLike<number>;
|
|
4
2
|
declare type BytesLike = Bytes | string;
|
|
5
3
|
interface Hexable {
|
|
@@ -331,7 +329,7 @@ interface ConfigurationParameters {
|
|
|
331
329
|
baseOptions?: any;
|
|
332
330
|
formDataCtor?: new () => any;
|
|
333
331
|
}
|
|
334
|
-
declare class Configuration {
|
|
332
|
+
declare class Configuration$1 {
|
|
335
333
|
/**
|
|
336
334
|
* parameter for apiKey security
|
|
337
335
|
* @param name security name
|
|
@@ -813,7 +811,7 @@ interface ImmutableXConfiguration {
|
|
|
813
811
|
/**
|
|
814
812
|
* The configuration for the API client
|
|
815
813
|
*/
|
|
816
|
-
apiConfiguration: Configuration;
|
|
814
|
+
apiConfiguration: Configuration$1;
|
|
817
815
|
/**
|
|
818
816
|
* The configuration for the Ethereum network
|
|
819
817
|
*/
|
|
@@ -905,10 +903,24 @@ interface IMXProvider {
|
|
|
905
903
|
completeWithdrawal(starkPublicKey: string, token: AnyToken): Promise<TransactionResponse>;
|
|
906
904
|
}
|
|
907
905
|
|
|
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
|
+
|
|
908
920
|
declare class GenericIMXProvider implements IMXProvider {
|
|
909
921
|
private readonly config;
|
|
910
922
|
private readonly signers;
|
|
911
|
-
constructor(config:
|
|
923
|
+
constructor(config: Configuration, ethSigner: Signer, starkExSigner: StarkSigner);
|
|
912
924
|
getAddress(): Promise<string>;
|
|
913
925
|
registerOffchain(): Promise<RegisterUserResponse>;
|
|
914
926
|
batchNftTransfer(request: Array<NftTransferDetails>): Promise<CreateTransferResponse>;
|
|
@@ -925,38 +937,10 @@ declare class GenericIMXProvider implements IMXProvider {
|
|
|
925
937
|
|
|
926
938
|
declare class MetaMaskIMXProvider extends GenericIMXProvider {
|
|
927
939
|
private static imxSigner;
|
|
928
|
-
constructor(config:
|
|
929
|
-
static connect(config:
|
|
940
|
+
constructor(config: Configuration, ethSigner: Signer, starkExSigner: StarkSigner);
|
|
941
|
+
static connect(config: Configuration): Promise<MetaMaskIMXProvider>;
|
|
930
942
|
static disconnect(): Promise<void>;
|
|
931
943
|
static signMessage(message: string): Promise<string>;
|
|
932
944
|
}
|
|
933
945
|
|
|
934
|
-
|
|
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 };
|
|
946
|
+
export { GenericIMXProvider, IMXProvider, MetaMaskIMXProvider };
|