@reown/appkit-core-react-native 1.2.6 → 1.3.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/lib/commonjs/controllers/BlockchainApiController.js +65 -1
- package/lib/commonjs/controllers/BlockchainApiController.js.map +1 -1
- package/lib/commonjs/controllers/ConnectorController.js +3 -3
- package/lib/commonjs/controllers/ConnectorController.js.map +1 -1
- package/lib/commonjs/controllers/ModalController.js.map +1 -1
- package/lib/commonjs/controllers/NetworkController.js +2 -2
- package/lib/commonjs/controllers/NetworkController.js.map +1 -1
- package/lib/commonjs/controllers/OnRampController.js +475 -0
- package/lib/commonjs/controllers/OnRampController.js.map +1 -0
- package/lib/commonjs/controllers/OptionsController.js +3 -0
- package/lib/commonjs/controllers/OptionsController.js.map +1 -1
- package/lib/commonjs/controllers/RouterController.js +3 -2
- package/lib/commonjs/controllers/RouterController.js.map +1 -1
- package/lib/commonjs/index.js +7 -0
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/utils/AssetUtil.js +8 -5
- package/lib/commonjs/utils/AssetUtil.js.map +1 -1
- package/lib/commonjs/utils/ConstantsUtil.js +69 -5
- package/lib/commonjs/utils/ConstantsUtil.js.map +1 -1
- package/lib/commonjs/utils/CoreHelperUtil.js +28 -0
- package/lib/commonjs/utils/CoreHelperUtil.js.map +1 -1
- package/lib/commonjs/utils/FetchUtil.js +20 -4
- package/lib/commonjs/utils/FetchUtil.js.map +1 -1
- package/lib/commonjs/utils/StorageUtil.js +185 -1
- package/lib/commonjs/utils/StorageUtil.js.map +1 -1
- package/lib/commonjs/utils/TypeUtil.js +29 -0
- package/lib/commonjs/utils/TypeUtil.js.map +1 -1
- package/lib/module/controllers/BlockchainApiController.js +64 -0
- package/lib/module/controllers/BlockchainApiController.js.map +1 -1
- package/lib/module/controllers/ConnectorController.js +3 -3
- package/lib/module/controllers/ConnectorController.js.map +1 -1
- package/lib/module/controllers/ModalController.js.map +1 -1
- package/lib/module/controllers/NetworkController.js +2 -2
- package/lib/module/controllers/NetworkController.js.map +1 -1
- package/lib/module/controllers/OnRampController.js +470 -0
- package/lib/module/controllers/OnRampController.js.map +1 -0
- package/lib/module/controllers/OptionsController.js +3 -0
- package/lib/module/controllers/OptionsController.js.map +1 -1
- package/lib/module/controllers/RouterController.js +3 -2
- package/lib/module/controllers/RouterController.js.map +1 -1
- package/lib/module/index.js +1 -0
- package/lib/module/index.js.map +1 -1
- package/lib/module/utils/AssetUtil.js +8 -5
- package/lib/module/utils/AssetUtil.js.map +1 -1
- package/lib/module/utils/ConstantsUtil.js +68 -4
- package/lib/module/utils/ConstantsUtil.js.map +1 -1
- package/lib/module/utils/CoreHelperUtil.js +26 -0
- package/lib/module/utils/CoreHelperUtil.js.map +1 -1
- package/lib/module/utils/FetchUtil.js +20 -4
- package/lib/module/utils/FetchUtil.js.map +1 -1
- package/lib/module/utils/StorageUtil.js +186 -1
- package/lib/module/utils/StorageUtil.js.map +1 -1
- package/lib/module/utils/TypeUtil.js +27 -1
- package/lib/module/utils/TypeUtil.js.map +1 -1
- package/lib/typescript/controllers/BlockchainApiController.d.ts +16 -1
- package/lib/typescript/controllers/BlockchainApiController.d.ts.map +1 -1
- package/lib/typescript/controllers/ConnectorController.d.ts +1 -1
- package/lib/typescript/controllers/ModalController.d.ts +1 -1
- package/lib/typescript/controllers/ModalController.d.ts.map +1 -1
- package/lib/typescript/controllers/NetworkController.d.ts +3 -2
- package/lib/typescript/controllers/NetworkController.d.ts.map +1 -1
- package/lib/typescript/controllers/OnRampController.d.ts +55 -0
- package/lib/typescript/controllers/OnRampController.d.ts.map +1 -0
- package/lib/typescript/controllers/OptionsController.d.ts +2 -0
- package/lib/typescript/controllers/OptionsController.d.ts.map +1 -1
- package/lib/typescript/controllers/RouterController.d.ts +4 -3
- package/lib/typescript/controllers/RouterController.d.ts.map +1 -1
- package/lib/typescript/index.d.ts +1 -0
- package/lib/typescript/index.d.ts.map +1 -1
- package/lib/typescript/utils/AssetUtil.d.ts +1 -1
- package/lib/typescript/utils/AssetUtil.d.ts.map +1 -1
- package/lib/typescript/utils/ConstantsUtil.d.ts +55 -0
- package/lib/typescript/utils/ConstantsUtil.d.ts.map +1 -1
- package/lib/typescript/utils/CoreHelperUtil.d.ts +3 -0
- package/lib/typescript/utils/CoreHelperUtil.d.ts.map +1 -1
- package/lib/typescript/utils/FetchUtil.d.ts +4 -4
- package/lib/typescript/utils/FetchUtil.d.ts.map +1 -1
- package/lib/typescript/utils/StorageUtil.d.ts +16 -2
- package/lib/typescript/utils/StorageUtil.d.ts.map +1 -1
- package/lib/typescript/utils/TypeUtil.d.ts +172 -0
- package/lib/typescript/utils/TypeUtil.d.ts.map +1 -1
- package/package.json +3 -2
- package/src/controllers/BlockchainApiController.ts +87 -1
- package/src/controllers/ConnectorController.ts +3 -3
- package/src/controllers/ModalController.ts +1 -2
- package/src/controllers/NetworkController.ts +4 -4
- package/src/controllers/OnRampController.ts +663 -0
- package/src/controllers/OptionsController.ts +5 -0
- package/src/controllers/RouterController.ts +16 -3
- package/src/index.ts +1 -0
- package/src/utils/AssetUtil.ts +9 -5
- package/src/utils/ConstantsUtil.ts +49 -4
- package/src/utils/CoreHelperUtil.ts +30 -0
- package/src/utils/FetchUtil.ts +21 -8
- package/src/utils/StorageUtil.ts +225 -3
- package/src/utils/TypeUtil.ts +201 -1
package/src/utils/TypeUtil.ts
CHANGED
|
@@ -6,6 +6,7 @@ import type {
|
|
|
6
6
|
Transaction,
|
|
7
7
|
ConnectorType
|
|
8
8
|
} from '@reown/appkit-common-react-native';
|
|
9
|
+
import { OnRampErrorType } from './ConstantsUtil';
|
|
9
10
|
|
|
10
11
|
export interface BaseError {
|
|
11
12
|
message?: string;
|
|
@@ -83,6 +84,11 @@ export type Features = {
|
|
|
83
84
|
* @type {boolean}
|
|
84
85
|
*/
|
|
85
86
|
swaps?: boolean;
|
|
87
|
+
/**
|
|
88
|
+
* @description Enable or disable the onramp feature. Enabled by default.
|
|
89
|
+
* @type {boolean}
|
|
90
|
+
*/
|
|
91
|
+
onramp?: boolean;
|
|
86
92
|
/**
|
|
87
93
|
* @description Enable or disable the email feature. Enabled by default.
|
|
88
94
|
* @type {boolean}
|
|
@@ -311,10 +317,44 @@ export interface BlockchainApiSwapTokensRequest {
|
|
|
311
317
|
chainId?: string;
|
|
312
318
|
}
|
|
313
319
|
|
|
320
|
+
export interface BlockchainApiOnRampQuotesRequest {
|
|
321
|
+
countryCode: string;
|
|
322
|
+
paymentMethodType?: string;
|
|
323
|
+
destinationCurrencyCode: string;
|
|
324
|
+
sourceAmount: number;
|
|
325
|
+
sourceCurrencyCode: string;
|
|
326
|
+
walletAddress: string;
|
|
327
|
+
excludeProviders?: string[];
|
|
328
|
+
}
|
|
329
|
+
|
|
314
330
|
export interface BlockchainApiSwapTokensResponse {
|
|
315
331
|
tokens: SwapToken[];
|
|
316
332
|
}
|
|
317
333
|
|
|
334
|
+
export interface BlockchainApiOnRampWidgetRequest {
|
|
335
|
+
countryCode: string;
|
|
336
|
+
destinationCurrencyCode: string;
|
|
337
|
+
paymentMethodType: string;
|
|
338
|
+
serviceProvider: string;
|
|
339
|
+
sourceAmount: number;
|
|
340
|
+
sourceCurrencyCode: string;
|
|
341
|
+
walletAddress: string;
|
|
342
|
+
redirectUrl?: string;
|
|
343
|
+
}
|
|
344
|
+
|
|
345
|
+
export type BlockchainApiOnRampWidgetResponse = {
|
|
346
|
+
widgetUrl: string;
|
|
347
|
+
};
|
|
348
|
+
|
|
349
|
+
export class BlockchainOnRampError extends Error {
|
|
350
|
+
code: string;
|
|
351
|
+
constructor(code: string, message: string) {
|
|
352
|
+
super(message);
|
|
353
|
+
this.code = code;
|
|
354
|
+
this.message = message;
|
|
355
|
+
}
|
|
356
|
+
}
|
|
357
|
+
|
|
318
358
|
// -- OptionsController Types ---------------------------------------------------
|
|
319
359
|
export interface Token {
|
|
320
360
|
address: string;
|
|
@@ -699,6 +739,63 @@ export type Event =
|
|
|
699
739
|
accountType: AppKitFrameAccountType;
|
|
700
740
|
network: string;
|
|
701
741
|
};
|
|
742
|
+
}
|
|
743
|
+
| {
|
|
744
|
+
type: 'track';
|
|
745
|
+
event: 'SELECT_BUY_CRYPTO';
|
|
746
|
+
}
|
|
747
|
+
| {
|
|
748
|
+
type: 'track';
|
|
749
|
+
event: 'SELECT_BUY_ASSET';
|
|
750
|
+
properties: {
|
|
751
|
+
asset: string;
|
|
752
|
+
};
|
|
753
|
+
}
|
|
754
|
+
| {
|
|
755
|
+
type: 'track';
|
|
756
|
+
event: 'BUY_SUBMITTED';
|
|
757
|
+
properties: {
|
|
758
|
+
asset?: string;
|
|
759
|
+
network?: string;
|
|
760
|
+
amount?: string;
|
|
761
|
+
currency?: string;
|
|
762
|
+
provider?: string;
|
|
763
|
+
serviceProvider?: string;
|
|
764
|
+
paymentMethod?: string;
|
|
765
|
+
};
|
|
766
|
+
}
|
|
767
|
+
| {
|
|
768
|
+
type: 'track';
|
|
769
|
+
event: 'BUY_SUCCESS';
|
|
770
|
+
properties: {
|
|
771
|
+
asset?: string | null;
|
|
772
|
+
network?: string | null;
|
|
773
|
+
amount?: string | null;
|
|
774
|
+
currency?: string | null;
|
|
775
|
+
provider?: string | null;
|
|
776
|
+
orderId?: string | null;
|
|
777
|
+
};
|
|
778
|
+
}
|
|
779
|
+
| {
|
|
780
|
+
type: 'track';
|
|
781
|
+
event: 'BUY_FAIL';
|
|
782
|
+
properties: {
|
|
783
|
+
asset?: string;
|
|
784
|
+
network?: string;
|
|
785
|
+
amount?: string;
|
|
786
|
+
currency?: string;
|
|
787
|
+
provider?: string;
|
|
788
|
+
serviceProvider?: string;
|
|
789
|
+
paymentMethod?: string;
|
|
790
|
+
message?: string;
|
|
791
|
+
};
|
|
792
|
+
}
|
|
793
|
+
| {
|
|
794
|
+
type: 'track';
|
|
795
|
+
event: 'BUY_CANCEL';
|
|
796
|
+
properties?: {
|
|
797
|
+
message?: string;
|
|
798
|
+
};
|
|
702
799
|
};
|
|
703
800
|
|
|
704
801
|
// -- Send Controller Types -------------------------------------
|
|
@@ -749,6 +846,106 @@ export type SwapTokenWithBalance = SwapToken & {
|
|
|
749
846
|
|
|
750
847
|
export type SwapInputTarget = 'sourceToken' | 'toToken';
|
|
751
848
|
|
|
849
|
+
// -- OnRamp Controller Types ------------------------------------------------
|
|
850
|
+
export type OnRampErrorTypeValues = (typeof OnRampErrorType)[keyof typeof OnRampErrorType];
|
|
851
|
+
|
|
852
|
+
export interface OnRampError {
|
|
853
|
+
type: OnRampErrorTypeValues;
|
|
854
|
+
message: string;
|
|
855
|
+
}
|
|
856
|
+
|
|
857
|
+
export type OnRampPaymentMethod = {
|
|
858
|
+
logos: {
|
|
859
|
+
dark: string;
|
|
860
|
+
light: string;
|
|
861
|
+
};
|
|
862
|
+
name: string;
|
|
863
|
+
paymentMethod: string;
|
|
864
|
+
paymentType: string;
|
|
865
|
+
};
|
|
866
|
+
|
|
867
|
+
export type OnRampCountry = {
|
|
868
|
+
countryCode: string;
|
|
869
|
+
flagImageUrl: string;
|
|
870
|
+
name: string;
|
|
871
|
+
};
|
|
872
|
+
|
|
873
|
+
export type OnRampCountryDefaults = {
|
|
874
|
+
countryCode: string;
|
|
875
|
+
defaultCurrencyCode: string;
|
|
876
|
+
defaultPaymentMethods: string[];
|
|
877
|
+
};
|
|
878
|
+
|
|
879
|
+
export type OnRampFiatCurrency = {
|
|
880
|
+
currencyCode: string;
|
|
881
|
+
name: string;
|
|
882
|
+
symbolImageUrl: string;
|
|
883
|
+
};
|
|
884
|
+
|
|
885
|
+
export type OnRampCryptoCurrency = {
|
|
886
|
+
currencyCode: string;
|
|
887
|
+
name: string;
|
|
888
|
+
chainCode: string;
|
|
889
|
+
chainName: string;
|
|
890
|
+
chainId: string;
|
|
891
|
+
contractAddress: string | null;
|
|
892
|
+
symbolImageUrl: string;
|
|
893
|
+
};
|
|
894
|
+
|
|
895
|
+
export type OnRampQuote = {
|
|
896
|
+
countryCode: string;
|
|
897
|
+
customerScore: number;
|
|
898
|
+
destinationAmount: number;
|
|
899
|
+
destinationAmountWithoutFees: number;
|
|
900
|
+
destinationCurrencyCode: string;
|
|
901
|
+
exchangeRate: number;
|
|
902
|
+
fiatAmountWithoutFees: number;
|
|
903
|
+
lowKyc: boolean;
|
|
904
|
+
networkFee: number;
|
|
905
|
+
paymentMethodType: string;
|
|
906
|
+
serviceProvider: string;
|
|
907
|
+
sourceAmount: number;
|
|
908
|
+
sourceAmountWithoutFees: number;
|
|
909
|
+
sourceCurrencyCode: string;
|
|
910
|
+
totalFee: number;
|
|
911
|
+
transactionFee: number;
|
|
912
|
+
transactionType: string;
|
|
913
|
+
};
|
|
914
|
+
|
|
915
|
+
export type OnRampServiceProvider = {
|
|
916
|
+
categories: string[];
|
|
917
|
+
categoryStatuses: {
|
|
918
|
+
additionalProp: string;
|
|
919
|
+
};
|
|
920
|
+
logos: {
|
|
921
|
+
dark: string;
|
|
922
|
+
darkShort: string;
|
|
923
|
+
light: string;
|
|
924
|
+
lightShort: string;
|
|
925
|
+
};
|
|
926
|
+
name: string;
|
|
927
|
+
serviceProvider: string;
|
|
928
|
+
status: string;
|
|
929
|
+
websiteUrl: string;
|
|
930
|
+
};
|
|
931
|
+
|
|
932
|
+
export type OnRampFiatLimit = {
|
|
933
|
+
currencyCode: string;
|
|
934
|
+
defaultAmount: number | null;
|
|
935
|
+
minimumAmount: number;
|
|
936
|
+
maximumAmount: number;
|
|
937
|
+
};
|
|
938
|
+
|
|
939
|
+
export type OnRampTransactionResult = {
|
|
940
|
+
purchaseCurrency: string | null;
|
|
941
|
+
purchaseAmount: string | null;
|
|
942
|
+
purchaseImageUrl: string | null;
|
|
943
|
+
paymentCurrency: string | null;
|
|
944
|
+
paymentAmount: string | null;
|
|
945
|
+
status: string | null;
|
|
946
|
+
network: string | null;
|
|
947
|
+
};
|
|
948
|
+
|
|
752
949
|
// -- Email Types ------------------------------------------------
|
|
753
950
|
/**
|
|
754
951
|
* Matches type defined for packages/wallet/src/AppKitFrameProvider.ts
|
|
@@ -811,7 +1008,10 @@ export interface AppKitFrameProvider {
|
|
|
811
1008
|
sdkType: SdkType;
|
|
812
1009
|
metadata?: Metadata;
|
|
813
1010
|
}): Promise<unknown>;
|
|
814
|
-
connect(payload?: {
|
|
1011
|
+
connect(payload?: {
|
|
1012
|
+
chainId: number | undefined;
|
|
1013
|
+
preferredAccountType?: AppKitFrameAccountType;
|
|
1014
|
+
}): Promise<{
|
|
815
1015
|
chainId: number;
|
|
816
1016
|
email?: string | null;
|
|
817
1017
|
address: string;
|