@reown/appkit-core-react-native 0.0.0-feat-smart-account-20241017180406 → 0.0.0-feat-swaps-20241129153709
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/ApiController.js +19 -7
- package/lib/commonjs/controllers/ApiController.js.map +1 -1
- package/lib/commonjs/controllers/BlockchainApiController.js +163 -1
- package/lib/commonjs/controllers/BlockchainApiController.js.map +1 -1
- package/lib/commonjs/controllers/ConnectionController.js +5 -8
- package/lib/commonjs/controllers/ConnectionController.js.map +1 -1
- package/lib/commonjs/controllers/ConnectorController.js +9 -1
- package/lib/commonjs/controllers/ConnectorController.js.map +1 -1
- package/lib/commonjs/controllers/NetworkController.js +9 -0
- package/lib/commonjs/controllers/NetworkController.js.map +1 -1
- package/lib/commonjs/controllers/OptionsController.js +5 -1
- package/lib/commonjs/controllers/OptionsController.js.map +1 -1
- package/lib/commonjs/controllers/RouterController.js.map +1 -1
- package/lib/commonjs/controllers/SnackController.js +26 -1
- package/lib/commonjs/controllers/SnackController.js.map +1 -1
- package/lib/commonjs/controllers/SwapController.js +580 -6
- package/lib/commonjs/controllers/SwapController.js.map +1 -1
- package/lib/commonjs/controllers/WebviewController.js +13 -1
- package/lib/commonjs/controllers/WebviewController.js.map +1 -1
- package/lib/commonjs/utils/ApiUtil.js +9 -2
- package/lib/commonjs/utils/ApiUtil.js.map +1 -1
- package/lib/commonjs/utils/ConstantsUtil.js +30 -1
- package/lib/commonjs/utils/ConstantsUtil.js.map +1 -1
- package/lib/commonjs/utils/CoreHelperUtil.js +0 -12
- package/lib/commonjs/utils/CoreHelperUtil.js.map +1 -1
- package/lib/commonjs/utils/StorageUtil.js.map +1 -1
- package/lib/commonjs/utils/SwapApiUtil.js +58 -0
- package/lib/commonjs/utils/SwapApiUtil.js.map +1 -1
- package/lib/commonjs/utils/SwapCalculationUtil.js +73 -0
- package/lib/commonjs/utils/SwapCalculationUtil.js.map +1 -1
- package/lib/module/controllers/ApiController.js +19 -7
- package/lib/module/controllers/ApiController.js.map +1 -1
- package/lib/module/controllers/BlockchainApiController.js +163 -1
- package/lib/module/controllers/BlockchainApiController.js.map +1 -1
- package/lib/module/controllers/ConnectionController.js +5 -8
- package/lib/module/controllers/ConnectionController.js.map +1 -1
- package/lib/module/controllers/ConnectorController.js +9 -1
- package/lib/module/controllers/ConnectorController.js.map +1 -1
- package/lib/module/controllers/NetworkController.js +9 -0
- package/lib/module/controllers/NetworkController.js.map +1 -1
- package/lib/module/controllers/OptionsController.js +5 -1
- package/lib/module/controllers/OptionsController.js.map +1 -1
- package/lib/module/controllers/RouterController.js.map +1 -1
- package/lib/module/controllers/SnackController.js +26 -1
- package/lib/module/controllers/SnackController.js.map +1 -1
- package/lib/module/controllers/SwapController.js +579 -6
- package/lib/module/controllers/SwapController.js.map +1 -1
- package/lib/module/controllers/WebviewController.js +13 -1
- package/lib/module/controllers/WebviewController.js.map +1 -1
- package/lib/module/utils/ApiUtil.js +9 -2
- package/lib/module/utils/ApiUtil.js.map +1 -1
- package/lib/module/utils/ConstantsUtil.js +30 -1
- package/lib/module/utils/ConstantsUtil.js.map +1 -1
- package/lib/module/utils/CoreHelperUtil.js +0 -12
- package/lib/module/utils/CoreHelperUtil.js.map +1 -1
- package/lib/module/utils/StorageUtil.js.map +1 -1
- package/lib/module/utils/SwapApiUtil.js +58 -0
- package/lib/module/utils/SwapApiUtil.js.map +1 -1
- package/lib/module/utils/SwapCalculationUtil.js +73 -1
- package/lib/module/utils/SwapCalculationUtil.js.map +1 -1
- package/lib/typescript/controllers/ApiController.d.ts +3 -1
- package/lib/typescript/controllers/ApiController.d.ts.map +1 -1
- package/lib/typescript/controllers/BlockchainApiController.d.ts +6 -1
- package/lib/typescript/controllers/BlockchainApiController.d.ts.map +1 -1
- package/lib/typescript/controllers/ConnectionController.d.ts +3 -1
- package/lib/typescript/controllers/ConnectionController.d.ts.map +1 -1
- package/lib/typescript/controllers/ConnectorController.d.ts +1 -1
- package/lib/typescript/controllers/ConnectorController.d.ts.map +1 -1
- package/lib/typescript/controllers/NetworkController.d.ts +2 -0
- package/lib/typescript/controllers/NetworkController.d.ts.map +1 -1
- 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 +3 -2
- package/lib/typescript/controllers/RouterController.d.ts.map +1 -1
- package/lib/typescript/controllers/SnackController.d.ts +9 -1
- package/lib/typescript/controllers/SnackController.d.ts.map +1 -1
- package/lib/typescript/controllers/SwapController.d.ts +87 -0
- package/lib/typescript/controllers/SwapController.d.ts.map +1 -1
- package/lib/typescript/controllers/WebviewController.d.ts +3 -0
- package/lib/typescript/controllers/WebviewController.d.ts.map +1 -1
- package/lib/typescript/utils/ApiUtil.d.ts +1 -0
- package/lib/typescript/utils/ApiUtil.d.ts.map +1 -1
- package/lib/typescript/utils/ConstantsUtil.d.ts +4 -0
- package/lib/typescript/utils/ConstantsUtil.d.ts.map +1 -1
- package/lib/typescript/utils/CoreHelperUtil.d.ts +0 -1
- package/lib/typescript/utils/CoreHelperUtil.d.ts.map +1 -1
- package/lib/typescript/utils/StorageUtil.d.ts +1 -1
- package/lib/typescript/utils/StorageUtil.d.ts.map +1 -1
- package/lib/typescript/utils/SwapApiUtil.d.ts +8 -0
- package/lib/typescript/utils/SwapApiUtil.d.ts.map +1 -1
- package/lib/typescript/utils/SwapCalculationUtil.d.ts +19 -0
- package/lib/typescript/utils/SwapCalculationUtil.d.ts.map +1 -1
- package/lib/typescript/utils/TypeUtil.d.ts +151 -5
- package/lib/typescript/utils/TypeUtil.d.ts.map +1 -1
- package/package.json +2 -2
- package/src/controllers/ApiController.ts +32 -17
- package/src/controllers/BlockchainApiController.ts +153 -1
- package/src/controllers/ConnectionController.ts +7 -8
- package/src/controllers/ConnectorController.ts +13 -1
- package/src/controllers/NetworkController.ts +15 -0
- package/src/controllers/OptionsController.ts +7 -1
- package/src/controllers/RouterController.ts +6 -1
- package/src/controllers/SnackController.ts +35 -2
- package/src/controllers/SwapController.ts +750 -6
- package/src/controllers/WebviewController.ts +16 -1
- package/src/utils/ApiUtil.ts +14 -6
- package/src/utils/ConstantsUtil.ts +121 -1
- package/src/utils/CoreHelperUtil.ts +0 -14
- package/src/utils/StorageUtil.ts +1 -1
- package/src/utils/SwapApiUtil.ts +89 -0
- package/src/utils/SwapCalculationUtil.ts +125 -0
- package/src/utils/TypeUtil.ts +171 -10
|
@@ -16,6 +16,7 @@ export interface OptionsControllerState {
|
|
|
16
16
|
metadata?: Metadata;
|
|
17
17
|
isSiweEnabled?: boolean;
|
|
18
18
|
features?: Features;
|
|
19
|
+
debug?: boolean;
|
|
19
20
|
}
|
|
20
21
|
export declare const OptionsController: {
|
|
21
22
|
state: OptionsControllerState;
|
|
@@ -31,6 +32,7 @@ export declare const OptionsController: {
|
|
|
31
32
|
setMetadata(metadata: OptionsControllerState['metadata']): void;
|
|
32
33
|
setIsSiweEnabled(isSiweEnabled: OptionsControllerState['isSiweEnabled']): void;
|
|
33
34
|
setFeatures(features: OptionsControllerState['features']): void;
|
|
35
|
+
setDebug(debug: OptionsControllerState['debug']): void;
|
|
34
36
|
isClipboardAvailable(): boolean;
|
|
35
37
|
copyToClipboard(value: string): void;
|
|
36
38
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OptionsController.d.ts","sourceRoot":"","sources":["../../../src/controllers/OptionsController.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,YAAY,EACZ,QAAQ,EACR,QAAQ,EACR,SAAS,EACT,OAAO,EACP,UAAU,EACV,MAAM,EACP,MAAM,mBAAmB,CAAC;AAI3B,MAAM,WAAW,eAAe;IAC9B,SAAS,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;CAC7C;AAED,MAAM,WAAW,sBAAsB;IACrC,SAAS,EAAE,SAAS,CAAC;IACrB,gBAAgB,CAAC,EAAE,eAAe,CAAC;IACnC,gBAAgB,CAAC,EAAE,MAAM,EAAE,CAAC;IAC5B,gBAAgB,CAAC,EAAE,MAAM,EAAE,CAAC;IAC5B,iBAAiB,CAAC,EAAE,MAAM,EAAE,CAAC;IAC7B,aAAa,CAAC,EAAE,YAAY,EAAE,CAAC;IAC/B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,OAAO,EAAE,OAAO,CAAC;IACjB,UAAU,EAAE,UAAU,CAAC;IACvB,QAAQ,CAAC,EAAE,QAAQ,CAAC;IACpB,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,QAAQ,CAAC,EAAE,QAAQ,CAAC;
|
|
1
|
+
{"version":3,"file":"OptionsController.d.ts","sourceRoot":"","sources":["../../../src/controllers/OptionsController.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,YAAY,EACZ,QAAQ,EACR,QAAQ,EACR,SAAS,EACT,OAAO,EACP,UAAU,EACV,MAAM,EACP,MAAM,mBAAmB,CAAC;AAI3B,MAAM,WAAW,eAAe;IAC9B,SAAS,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;CAC7C;AAED,MAAM,WAAW,sBAAsB;IACrC,SAAS,EAAE,SAAS,CAAC;IACrB,gBAAgB,CAAC,EAAE,eAAe,CAAC;IACnC,gBAAgB,CAAC,EAAE,MAAM,EAAE,CAAC;IAC5B,gBAAgB,CAAC,EAAE,MAAM,EAAE,CAAC;IAC5B,iBAAiB,CAAC,EAAE,MAAM,EAAE,CAAC;IAC7B,aAAa,CAAC,EAAE,YAAY,EAAE,CAAC;IAC/B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,OAAO,EAAE,OAAO,CAAC;IACjB,UAAU,EAAE,UAAU,CAAC;IACvB,QAAQ,CAAC,EAAE,QAAQ,CAAC;IACpB,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,QAAQ,CAAC,EAAE,QAAQ,CAAC;IACpB,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB;AAYD,eAAO,MAAM,iBAAiB;;+BAGD,eAAe;4BAIlB,sBAAsB,CAAC,WAAW,CAAC;0CAIrB,sBAAsB,CAAC,kBAAkB,CAAC;0CAI1C,sBAAsB,CAAC,kBAAkB,CAAC;4CAIxC,sBAAsB,CAAC,mBAAmB,CAAC;sBAIjE,sBAAsB,CAAC,QAAQ,CAAC;oCAIlB,sBAAsB,CAAC,eAAe,CAAC;wCAInC,sBAAsB,CAAC,iBAAiB,CAAC;8BAInD,sBAAsB,CAAC,YAAY,CAAC;0BAIxC,sBAAsB,CAAC,UAAU,CAAC;oCAIxB,sBAAsB,CAAC,eAAe,CAAC;0BAIjD,sBAAsB,CAAC,UAAU,CAAC;oBAIxC,sBAAsB,CAAC,OAAO,CAAC;;2BAQxB,MAAM;CAM9B,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { WcWallet, CaipNetwork, Connector } from '../utils/TypeUtil';
|
|
1
|
+
import type { WcWallet, CaipNetwork, Connector, SwapInputTarget } from '../utils/TypeUtil';
|
|
2
2
|
import type { SocialProvider } from '@reown/appkit-common-react-native';
|
|
3
3
|
type TransactionAction = {
|
|
4
4
|
goBack: boolean;
|
|
@@ -9,7 +9,7 @@ type TransactionAction = {
|
|
|
9
9
|
onCancel?: () => void;
|
|
10
10
|
};
|
|
11
11
|
export interface RouterControllerState {
|
|
12
|
-
view: 'Account' | 'AccountDefault' | 'AllWallets' | 'Connect' | 'ConnectSocials' | 'ConnectingExternal' | 'ConnectingSiwe' | 'ConnectingSocial' | 'ConnectingFarcaster' | 'ConnectingWalletConnect' | 'Create' | 'EmailVerifyDevice' | 'EmailVerifyOtp' | 'GetWallet' | 'Networks' | 'SwitchNetwork' | 'Transactions' | 'UpdateEmailPrimaryOtp' | 'UpdateEmailSecondaryOtp' | 'UpdateEmailWallet' | 'UpgradeEmailWallet' | 'UpgradeToSmartAccount' | 'WalletCompatibleNetworks' | 'WalletReceive' | 'WalletSend' | 'WalletSendPreview' | 'WalletSendSelectToken' | 'WhatIsANetwork' | 'WhatIsAWallet';
|
|
12
|
+
view: 'Account' | 'AccountDefault' | 'AllWallets' | 'Connect' | 'ConnectSocials' | 'ConnectingExternal' | 'ConnectingSiwe' | 'ConnectingSocial' | 'ConnectingFarcaster' | 'ConnectingWalletConnect' | 'Create' | 'EmailVerifyDevice' | 'EmailVerifyOtp' | 'GetWallet' | 'Networks' | 'SwitchNetwork' | 'Swap' | 'SwapSelectToken' | 'SwapPreview' | 'Transactions' | 'UnsupportedChain' | 'UpdateEmailPrimaryOtp' | 'UpdateEmailSecondaryOtp' | 'UpdateEmailWallet' | 'UpgradeEmailWallet' | 'UpgradeToSmartAccount' | 'WalletCompatibleNetworks' | 'WalletReceive' | 'WalletSend' | 'WalletSendPreview' | 'WalletSendSelectToken' | 'WhatIsANetwork' | 'WhatIsAWallet';
|
|
13
13
|
history: RouterControllerState['view'][];
|
|
14
14
|
data?: {
|
|
15
15
|
connector?: Connector;
|
|
@@ -18,6 +18,7 @@ export interface RouterControllerState {
|
|
|
18
18
|
email?: string;
|
|
19
19
|
newEmail?: string;
|
|
20
20
|
socialProvider?: SocialProvider;
|
|
21
|
+
swapTarget?: SwapInputTarget;
|
|
21
22
|
};
|
|
22
23
|
transactionStack: TransactionAction[];
|
|
23
24
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RouterController.d.ts","sourceRoot":"","sources":["../../../src/controllers/RouterController.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,QAAQ,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"RouterController.d.ts","sourceRoot":"","sources":["../../../src/controllers/RouterController.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,QAAQ,EAAE,WAAW,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAC3F,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,mCAAmC,CAAC;AAGxE,KAAK,iBAAiB,GAAG;IACvB,MAAM,EAAE,OAAO,CAAC;IAChB,IAAI,EAAE,qBAAqB,CAAC,MAAM,CAAC,GAAG,IAAI,CAAC;IAC3C,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,SAAS,CAAC,EAAE,MAAM,IAAI,CAAC;IACvB,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAC;CACvB,CAAC;AAEF,MAAM,WAAW,qBAAqB;IACpC,IAAI,EACA,SAAS,GACT,gBAAgB,GAChB,YAAY,GACZ,SAAS,GACT,gBAAgB,GAChB,oBAAoB,GACpB,gBAAgB,GAChB,kBAAkB,GAClB,qBAAqB,GACrB,yBAAyB,GACzB,QAAQ,GACR,mBAAmB,GACnB,gBAAgB,GAChB,WAAW,GACX,UAAU,GACV,eAAe,GACf,MAAM,GACN,iBAAiB,GACjB,aAAa,GACb,cAAc,GACd,kBAAkB,GAClB,uBAAuB,GACvB,yBAAyB,GACzB,mBAAmB,GACnB,oBAAoB,GACpB,uBAAuB,GACvB,0BAA0B,GAC1B,eAAe,GACf,YAAY,GACZ,mBAAmB,GACnB,uBAAuB,GACvB,gBAAgB,GAChB,eAAe,CAAC;IACpB,OAAO,EAAE,qBAAqB,CAAC,MAAM,CAAC,EAAE,CAAC;IACzC,IAAI,CAAC,EAAE;QACL,SAAS,CAAC,EAAE,SAAS,CAAC;QACtB,MAAM,CAAC,EAAE,QAAQ,CAAC;QAClB,OAAO,CAAC,EAAE,WAAW,CAAC;QACtB,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,QAAQ,CAAC,EAAE,MAAM,CAAC;QAClB,cAAc,CAAC,EAAE,cAAc,CAAC;QAChC,UAAU,CAAC,EAAE,eAAe,CAAC;KAC9B,CAAC;IACF,gBAAgB,EAAE,iBAAiB,EAAE,CAAC;CACvC;AAUD,eAAO,MAAM,gBAAgB;;eAGhB,qBAAqB,CAAC,MAAM,CAAC,SAAS,qBAAqB,CAAC,MAAM,CAAC;iCAQjD,iBAAiB;iCAIjB,OAAO;gBAoBxB,qBAAqB,CAAC,MAAM,CAAC;kBAK3B,qBAAqB,CAAC,MAAM,CAAC,SAAS,qBAAqB,CAAC,MAAM,CAAC;;gCAkBrD,MAAM;CASnC,CAAC"}
|
|
@@ -1,12 +1,20 @@
|
|
|
1
|
+
interface Message {
|
|
2
|
+
shortMessage: string;
|
|
3
|
+
longMessage?: string;
|
|
4
|
+
}
|
|
1
5
|
export interface SnackControllerState {
|
|
2
6
|
message: string;
|
|
3
|
-
variant: 'error' | 'success';
|
|
7
|
+
variant: 'error' | 'success' | 'loading';
|
|
4
8
|
open: boolean;
|
|
9
|
+
long: boolean;
|
|
5
10
|
}
|
|
6
11
|
export declare const SnackController: {
|
|
7
12
|
state: SnackControllerState;
|
|
8
13
|
showSuccess(message: SnackControllerState['message']): void;
|
|
9
14
|
showError(message: SnackControllerState['message']): void;
|
|
15
|
+
showLoading(message: SnackControllerState['message']): void;
|
|
16
|
+
showInternalError(error: Message): void;
|
|
10
17
|
hide(): void;
|
|
11
18
|
};
|
|
19
|
+
export {};
|
|
12
20
|
//# sourceMappingURL=SnackController.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SnackController.d.ts","sourceRoot":"","sources":["../../../src/controllers/SnackController.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"SnackController.d.ts","sourceRoot":"","sources":["../../../src/controllers/SnackController.ts"],"names":[],"mappings":"AAIA,UAAU,OAAO;IACf,YAAY,EAAE,MAAM,CAAC;IACrB,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,WAAW,oBAAoB;IACnC,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,OAAO,GAAG,SAAS,GAAG,SAAS,CAAC;IACzC,IAAI,EAAE,OAAO,CAAC;IACd,IAAI,EAAE,OAAO,CAAC;CACf;AAWD,eAAO,MAAM,eAAe;;yBAGL,oBAAoB,CAAC,SAAS,CAAC;uBAMjC,oBAAoB,CAAC,SAAS,CAAC;yBAM7B,oBAAoB,CAAC,SAAS,CAAC;6BAM3B,OAAO;;CAsBjC,CAAC"}
|
|
@@ -1,11 +1,48 @@
|
|
|
1
|
+
import type { SwapInputTarget, SwapTokenWithBalance } from '../utils/TypeUtil';
|
|
1
2
|
export declare const INITIAL_GAS_LIMIT = 150000;
|
|
2
3
|
export declare const TO_AMOUNT_DECIMALS = 6;
|
|
4
|
+
type TransactionParams = {
|
|
5
|
+
data: string;
|
|
6
|
+
to: string;
|
|
7
|
+
gas: bigint;
|
|
8
|
+
gasPrice: bigint;
|
|
9
|
+
value: bigint;
|
|
10
|
+
toAmount: string;
|
|
11
|
+
};
|
|
3
12
|
export interface SwapControllerState {
|
|
13
|
+
initializing: boolean;
|
|
14
|
+
initialized: boolean;
|
|
15
|
+
loadingPrices: boolean;
|
|
16
|
+
loadingQuote?: boolean;
|
|
17
|
+
loadingApprovalTransaction?: boolean;
|
|
18
|
+
loadingBuildTransaction?: boolean;
|
|
19
|
+
loadingTransaction?: boolean;
|
|
20
|
+
fetchError: boolean;
|
|
21
|
+
approvalTransaction: TransactionParams | undefined;
|
|
22
|
+
swapTransaction: TransactionParams | undefined;
|
|
23
|
+
transactionError?: string;
|
|
24
|
+
sourceToken?: SwapTokenWithBalance;
|
|
25
|
+
sourceTokenAmount: string;
|
|
26
|
+
sourceTokenPriceInUSD: number;
|
|
27
|
+
toToken?: SwapTokenWithBalance;
|
|
28
|
+
toTokenAmount: string;
|
|
29
|
+
toTokenPriceInUSD: number;
|
|
4
30
|
networkPrice: string;
|
|
31
|
+
networkBalanceInUSD: string;
|
|
5
32
|
networkTokenSymbol: string;
|
|
33
|
+
inputError: string | undefined;
|
|
34
|
+
slippage: number;
|
|
35
|
+
tokens?: SwapTokenWithBalance[];
|
|
36
|
+
suggestedTokens?: SwapTokenWithBalance[];
|
|
37
|
+
popularTokens?: SwapTokenWithBalance[];
|
|
38
|
+
foundTokens?: SwapTokenWithBalance[];
|
|
39
|
+
myTokensWithBalance?: SwapTokenWithBalance[];
|
|
6
40
|
tokensPriceMap: Record<string, number>;
|
|
7
41
|
gasFee: string;
|
|
8
42
|
gasPriceInUSD?: number;
|
|
43
|
+
priceImpact: number | undefined;
|
|
44
|
+
maxSlippage: number | undefined;
|
|
45
|
+
providerFee: string | undefined;
|
|
9
46
|
}
|
|
10
47
|
export declare const SwapController: {
|
|
11
48
|
state: SwapControllerState;
|
|
@@ -13,8 +50,30 @@ export declare const SwapController: {
|
|
|
13
50
|
subscribeKey<K extends keyof SwapControllerState>(key: K, callback: (value: SwapControllerState[K]) => void): () => void;
|
|
14
51
|
getParams(): {
|
|
15
52
|
networkAddress: string;
|
|
53
|
+
fromAddress: string;
|
|
54
|
+
fromCaipAddress: `${string}:${string}:${string}` | undefined;
|
|
55
|
+
sourceTokenAddress: `${string}:${string}:${string}` | undefined;
|
|
56
|
+
toTokenAddress: `${string}:${string}:${string}` | undefined;
|
|
57
|
+
toTokenAmount: string;
|
|
58
|
+
toTokenDecimals: number | undefined;
|
|
59
|
+
sourceTokenAmount: string;
|
|
60
|
+
sourceTokenDecimals: number | undefined;
|
|
61
|
+
invalidToToken: boolean;
|
|
62
|
+
invalidSourceToken: boolean;
|
|
63
|
+
invalidSourceTokenAmount: boolean;
|
|
64
|
+
availableToSwap: boolean | undefined;
|
|
65
|
+
isAuthConnector: boolean;
|
|
16
66
|
};
|
|
67
|
+
switchTokens(): void;
|
|
17
68
|
resetState(): void;
|
|
69
|
+
fetchTokens(): Promise<void>;
|
|
70
|
+
getTokenList(): Promise<void>;
|
|
71
|
+
getMyTokensWithBalance(forceUpdate?: string): Promise<void>;
|
|
72
|
+
getFilteredPopularTokens(): SwapTokenWithBalance[] | undefined;
|
|
73
|
+
setSourceToken(sourceToken: SwapTokenWithBalance | undefined): void;
|
|
74
|
+
setSourceTokenAmount(amount: string): void;
|
|
75
|
+
initializeState(): Promise<void>;
|
|
76
|
+
getAddressPrice(address: string): Promise<number>;
|
|
18
77
|
getNetworkTokenPrice(): Promise<void>;
|
|
19
78
|
getInitialGasPrice(): Promise<{
|
|
20
79
|
gasPrice: null;
|
|
@@ -25,5 +84,33 @@ export declare const SwapController: {
|
|
|
25
84
|
gasPriceInUSD: number;
|
|
26
85
|
gasPriceInUsd?: undefined;
|
|
27
86
|
}>;
|
|
87
|
+
getProviderFeePrice(): number;
|
|
88
|
+
setBalances(balances: SwapTokenWithBalance[]): void;
|
|
89
|
+
setToToken(toToken: SwapTokenWithBalance | undefined): void;
|
|
90
|
+
setToTokenAmount(amount: string): void;
|
|
91
|
+
setTokenPrice(address: string, target: SwapInputTarget): Promise<void>;
|
|
92
|
+
swapTokens(): Promise<void>;
|
|
93
|
+
getTransaction(): Promise<TransactionParams | undefined>;
|
|
94
|
+
createAllowanceTransaction(): Promise<{
|
|
95
|
+
data: `0x${string}`;
|
|
96
|
+
to: `0x${string}`;
|
|
97
|
+
gas: bigint;
|
|
98
|
+
gasPrice: bigint;
|
|
99
|
+
value: bigint;
|
|
100
|
+
toAmount: string;
|
|
101
|
+
} | undefined>;
|
|
102
|
+
createSwapTransaction(): Promise<{
|
|
103
|
+
data: `0x${string}`;
|
|
104
|
+
to: `0x${string}`;
|
|
105
|
+
gas: bigint;
|
|
106
|
+
gasPrice: bigint;
|
|
107
|
+
value: bigint;
|
|
108
|
+
toAmount: string;
|
|
109
|
+
} | undefined>;
|
|
110
|
+
sendTransactionForApproval(data: TransactionParams): Promise<void>;
|
|
111
|
+
sendTransactionForSwap(data: TransactionParams | undefined): Promise<`0x${string}` | null | undefined>;
|
|
112
|
+
hasInsufficientToken(sourceTokenAmount: string, sourceTokenAddress: string): boolean;
|
|
113
|
+
setTransactionDetails(): void;
|
|
28
114
|
};
|
|
115
|
+
export {};
|
|
29
116
|
//# sourceMappingURL=SwapController.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SwapController.d.ts","sourceRoot":"","sources":["../../../src/controllers/SwapController.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"SwapController.d.ts","sourceRoot":"","sources":["../../../src/controllers/SwapController.ts"],"names":[],"mappings":"AAYA,OAAO,KAAK,EAAE,eAAe,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AAS/E,eAAO,MAAM,iBAAiB,SAAS,CAAC;AACxC,eAAO,MAAM,kBAAkB,IAAI,CAAC;AAGpC,KAAK,iBAAiB,GAAG;IACvB,IAAI,EAAE,MAAM,CAAC;IACb,EAAE,EAAE,MAAM,CAAC;IACX,GAAG,EAAE,MAAM,CAAC;IACZ,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC;CAClB,CAAC;AAYF,MAAM,WAAW,mBAAmB;IAElC,YAAY,EAAE,OAAO,CAAC;IACtB,WAAW,EAAE,OAAO,CAAC;IACrB,aAAa,EAAE,OAAO,CAAC;IACvB,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,0BAA0B,CAAC,EAAE,OAAO,CAAC;IACrC,uBAAuB,CAAC,EAAE,OAAO,CAAC;IAClC,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAG7B,UAAU,EAAE,OAAO,CAAC;IAGpB,mBAAmB,EAAE,iBAAiB,GAAG,SAAS,CAAC;IACnD,eAAe,EAAE,iBAAiB,GAAG,SAAS,CAAC;IAC/C,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAG1B,WAAW,CAAC,EAAE,oBAAoB,CAAC;IACnC,iBAAiB,EAAE,MAAM,CAAC;IAC1B,qBAAqB,EAAE,MAAM,CAAC;IAC9B,OAAO,CAAC,EAAE,oBAAoB,CAAC;IAC/B,aAAa,EAAE,MAAM,CAAC;IACtB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,YAAY,EAAE,MAAM,CAAC;IACrB,mBAAmB,EAAE,MAAM,CAAC;IAC5B,kBAAkB,EAAE,MAAM,CAAC;IAC3B,UAAU,EAAE,MAAM,GAAG,SAAS,CAAC;IAG/B,QAAQ,EAAE,MAAM,CAAC;IAGjB,MAAM,CAAC,EAAE,oBAAoB,EAAE,CAAC;IAChC,eAAe,CAAC,EAAE,oBAAoB,EAAE,CAAC;IACzC,aAAa,CAAC,EAAE,oBAAoB,EAAE,CAAC;IACvC,WAAW,CAAC,EAAE,oBAAoB,EAAE,CAAC;IACrC,mBAAmB,CAAC,EAAE,oBAAoB,EAAE,CAAC;IAC7C,cAAc,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAGvC,MAAM,EAAE,MAAM,CAAC;IACf,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,WAAW,EAAE,MAAM,GAAG,SAAS,CAAC;IAChC,WAAW,EAAE,MAAM,GAAG,SAAS,CAAC;IAChC,WAAW,EAAE,MAAM,GAAG,SAAS,CAAC;CACjC;AAyDD,eAAO,MAAM,cAAc;;mCAGM,mBAAmB,KAAK,IAAI;2GAI2B,IAAI;;;;;;;;;;;;;;;;;;;;;yCA4H/C,MAAM;;gCAiBrB,oBAAoB,GAAG,SAAS;iCAa/B,MAAM;;6BA2BJ,MAAM;;;;;;;;;;;;0BA8Df,oBAAoB,EAAE;wBAqBxB,oBAAoB,GAAG,SAAS;6BAa3B,MAAM;2BAMF,MAAM,UAAU,eAAe;;;;;;;;;;;;;;;;;;;qCAmPrB,iBAAiB;iCAwCrB,iBAAiB,GAAG,SAAS;4CAuFxB,MAAM,sBAAsB,MAAM;;CA2C3E,CAAC"}
|
|
@@ -5,6 +5,7 @@ export interface WebviewControllerState {
|
|
|
5
5
|
webviewUrl?: string;
|
|
6
6
|
connecting?: boolean;
|
|
7
7
|
connectingProvider?: SocialProvider;
|
|
8
|
+
processingAuth?: boolean;
|
|
8
9
|
}
|
|
9
10
|
export declare const WebviewController: {
|
|
10
11
|
state: WebviewControllerState;
|
|
@@ -14,5 +15,7 @@ export declare const WebviewController: {
|
|
|
14
15
|
setWebviewUrl(url: WebviewControllerState['webviewUrl']): void;
|
|
15
16
|
setConnecting(connecting: WebviewControllerState['connecting']): void;
|
|
16
17
|
setConnectingProvider(provider: WebviewControllerState['connectingProvider']): void;
|
|
18
|
+
setProcessingAuth(processingAuth: WebviewControllerState['processingAuth']): void;
|
|
19
|
+
reset(): void;
|
|
17
20
|
};
|
|
18
21
|
//# sourceMappingURL=WebviewController.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"WebviewController.d.ts","sourceRoot":"","sources":["../../../src/controllers/WebviewController.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,mCAAmC,CAAC;AAIxE,MAAM,WAAW,sBAAsB;IACrC,gBAAgB,EAAE,OAAO,CAAC;IAC1B,cAAc,EAAE,OAAO,CAAC;IACxB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,kBAAkB,CAAC,EAAE,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"WebviewController.d.ts","sourceRoot":"","sources":["../../../src/controllers/WebviewController.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,mCAAmC,CAAC;AAIxE,MAAM,WAAW,sBAAsB;IACrC,gBAAgB,EAAE,OAAO,CAAC;IAC1B,cAAc,EAAE,OAAO,CAAC;IACxB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,kBAAkB,CAAC,EAAE,cAAc,CAAC;IACpC,cAAc,CAAC,EAAE,OAAO,CAAC;CAC1B;AAYD,eAAO,MAAM,iBAAiB;;mCAGG,sBAAsB,KAAK,IAAI;0CAIxB,sBAAsB,CAAC,kBAAkB,CAAC;+BAIrD,sBAAsB,CAAC,gBAAgB,CAAC;uBAIhD,sBAAsB,CAAC,YAAY,CAAC;8BAI7B,sBAAsB,CAAC,YAAY,CAAC;oCAI9B,sBAAsB,CAAC,oBAAoB,CAAC;sCAI1C,sBAAsB,CAAC,gBAAgB,CAAC;;CAY3E,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ApiUtil.d.ts","sourceRoot":"","sources":["../../../src/utils/ApiUtil.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,OAAO
|
|
1
|
+
{"version":3,"file":"ApiUtil.d.ts","sourceRoot":"","sources":["../../../src/utils/ApiUtil.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,OAAO;;;;CAsBnB,CAAC"}
|
|
@@ -6,6 +6,10 @@ export declare const ConstantsUtil: {
|
|
|
6
6
|
EMAIL_REGEX: RegExp;
|
|
7
7
|
LINKING_ERROR: string;
|
|
8
8
|
NATIVE_TOKEN_ADDRESS: string;
|
|
9
|
+
SWAP_SUGGESTED_TOKENS: string[];
|
|
10
|
+
SWAP_POPULAR_TOKENS: string[];
|
|
11
|
+
SWAP_SUPPORTED_NETWORKS: string[];
|
|
12
|
+
CONVERT_SLIPPAGE_TOLERANCE: number;
|
|
9
13
|
DEFAULT_FEATURES: Features;
|
|
10
14
|
};
|
|
11
15
|
//# sourceMappingURL=ConstantsUtil.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ConstantsUtil.d.ts","sourceRoot":"","sources":["../../../src/utils/ConstantsUtil.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"ConstantsUtil.d.ts","sourceRoot":"","sources":["../../../src/utils/ConstantsUtil.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAS3C,eAAO,MAAM,aAAa;;;;;;;;;;;;CAqIzB,CAAC"}
|
|
@@ -7,7 +7,6 @@ export declare const CoreHelperUtil: {
|
|
|
7
7
|
getNetworkId(caipAddress: CaipAddress | undefined): string | undefined;
|
|
8
8
|
getPlainAddress(caipAddress: CaipAddress | undefined): string | undefined;
|
|
9
9
|
wait(milliseconds: number): Promise<unknown>;
|
|
10
|
-
debounce(func: (...args: any[]) => unknown, timeout?: number): (...args: unknown[]) => void;
|
|
11
10
|
isHttpUrl(url: string): boolean;
|
|
12
11
|
isLinkModeURL(url?: string): boolean;
|
|
13
12
|
formatNativeUrl(appUrl: string, wcUri: string): LinkingRecord;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CoreHelperUtil.d.ts","sourceRoot":"","sources":["../../../src/utils/CoreHelperUtil.ts"],"names":[],"mappings":"AAGA,OAAO,EAAoC,KAAK,OAAO,EAAE,MAAM,mCAAmC,CAAC;AAGnG,OAAO,KAAK,EAAE,WAAW,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AA0BzE,eAAO,MAAM,cAAc;8BACC,MAAM;8BAIN,MAAM;;8BAQN,WAAW,GAAG,SAAS;iCAIpB,WAAW,GAAG,SAAS;uBAI3B,MAAM;
|
|
1
|
+
{"version":3,"file":"CoreHelperUtil.d.ts","sourceRoot":"","sources":["../../../src/utils/CoreHelperUtil.ts"],"names":[],"mappings":"AAGA,OAAO,EAAoC,KAAK,OAAO,EAAE,MAAM,mCAAmC,CAAC;AAGnG,OAAO,KAAK,EAAE,WAAW,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AA0BzE,eAAO,MAAM,cAAc;8BACC,MAAM;8BAIN,MAAM;;8BAQN,WAAW,GAAG,SAAS;iCAIpB,WAAW,GAAG,SAAS;uBAI3B,MAAM;mBAMhB,MAAM;wBAID,MAAM;4BAQF,MAAM,SAAS,MAAM,GAAG,aAAa;+BA2BlC,MAAM,SAAS,MAAM,GAAG,aAAa;kBAuB5C,MAAM;2BAQH,MAAM,GAAG,SAAS,UAAU,MAAM,GAAG,SAAS;uBAgBlD,MAAM,mBAAqB,OAAO;;;;;;sBAoEnC,GAAG,GAAG,MAAM;2BAYD,UAAU,GAAG,QAAQ,OAAO,CAAC;wBAiBtC,MAAM;yBAIL,QAAQ,OAAO,CAAC,EAAE;;;;;;;sCAUL,OAAO,EAAE;;;;CAe5C,CAAC"}
|
|
@@ -11,7 +11,7 @@ export declare const StorageUtil: {
|
|
|
11
11
|
setRecentWallets(wallets: WcWallet[]): Promise<void>;
|
|
12
12
|
getRecentWallets(): Promise<WcWallet[]>;
|
|
13
13
|
setConnectedConnector(connectorType: ConnectorType): Promise<void>;
|
|
14
|
-
getConnectedConnector(): Promise<
|
|
14
|
+
getConnectedConnector(): Promise<ConnectorType | undefined>;
|
|
15
15
|
removeConnectedConnector(): Promise<void>;
|
|
16
16
|
setConnectedWalletImageUrl(url: string): Promise<void>;
|
|
17
17
|
getConnectedWalletImageUrl(): Promise<string | null | undefined>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StorageUtil.d.ts","sourceRoot":"","sources":["../../../src/utils/StorageUtil.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAC1D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,mCAAmC,CAAC;AAUxE,eAAO,MAAM,WAAW;;cAC2B,MAAM;cAAQ,MAAM;;;;4BA6BvC,QAAQ;8BAuBN,QAAQ,EAAE;wBAQhB,QAAQ,QAAQ,EAAE,CAAC;yCAYF,aAAa
|
|
1
|
+
{"version":3,"file":"StorageUtil.d.ts","sourceRoot":"","sources":["../../../src/utils/StorageUtil.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAC1D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,mCAAmC,CAAC;AAUxE,eAAO,MAAM,WAAW;;cAC2B,MAAM;cAAQ,MAAM;;;;4BA6BvC,QAAQ;8BAuBN,QAAQ,EAAE;wBAQhB,QAAQ,QAAQ,EAAE,CAAC;yCAYF,aAAa;6BAQzB,QAAQ,aAAa,GAAG,SAAS,CAAC;;oCAoB3B,MAAM;;;yCA0BD,cAAc;;;CA2B1D,CAAC"}
|
|
@@ -1,4 +1,12 @@
|
|
|
1
|
+
import type { BlockchainApiBalanceResponse, BlockchainApiSwapAllowanceRequest, SwapTokenWithBalance } from './TypeUtil';
|
|
1
2
|
export declare const SwapApiUtil: {
|
|
3
|
+
getTokenList(): Promise<SwapTokenWithBalance[]>;
|
|
4
|
+
fetchSwapAllowance({ tokenAddress, userAddress, sourceTokenAmount, sourceTokenDecimals }: Pick<BlockchainApiSwapAllowanceRequest, "tokenAddress" | "userAddress"> & {
|
|
5
|
+
sourceTokenAmount: string;
|
|
6
|
+
sourceTokenDecimals: number;
|
|
7
|
+
}): Promise<boolean>;
|
|
8
|
+
getMyTokensWithBalance(forceUpdate?: string): Promise<SwapTokenWithBalance[]>;
|
|
9
|
+
mapBalancesToSwapTokens(balances?: BlockchainApiBalanceResponse['balances']): SwapTokenWithBalance[];
|
|
2
10
|
fetchGasPrice(): Promise<import("./TypeUtil").BlockchainApiGasPriceResponse | null | undefined>;
|
|
3
11
|
};
|
|
4
12
|
//# sourceMappingURL=SwapApiUtil.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SwapApiUtil.d.ts","sourceRoot":"","sources":["../../../src/utils/SwapApiUtil.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"SwapApiUtil.d.ts","sourceRoot":"","sources":["../../../src/utils/SwapApiUtil.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EACV,4BAA4B,EAC5B,iCAAiC,EACjC,oBAAoB,EACrB,MAAM,YAAY,CAAC;AAIpB,eAAO,MAAM,WAAW;;;2BA8BD,MAAM;6BACJ,MAAM;;yCAqBc,MAAM;uCAgBd,4BAA4B,CAAC,UAAU,CAAC;;CA4B5E,CAAC"}
|
|
@@ -1,5 +1,24 @@
|
|
|
1
|
+
import type { SwapTokenWithBalance } from './TypeUtil';
|
|
1
2
|
export declare const SwapCalculationUtil: {
|
|
2
3
|
getGasPriceInEther(gas: bigint, gasPrice: bigint): number;
|
|
3
4
|
getGasPriceInUSD(networkPrice: string, gas: bigint, gasPrice: bigint): number;
|
|
5
|
+
getPriceImpact({ sourceTokenAmount, sourceTokenPriceInUSD, toTokenPriceInUSD, toTokenAmount }: {
|
|
6
|
+
sourceTokenAmount: string;
|
|
7
|
+
sourceTokenPriceInUSD: number;
|
|
8
|
+
toTokenPriceInUSD: number;
|
|
9
|
+
toTokenAmount: string;
|
|
10
|
+
}): number;
|
|
11
|
+
getMaxSlippage(slippage: number, toTokenAmount: string): number;
|
|
12
|
+
getProviderFee(sourceTokenAmount: string, feePercentage?: number): string;
|
|
13
|
+
getProviderFeePrice(sourceTokenAmount: string, sourceTokenPriceInUSD: number, feePercentage?: number): number;
|
|
14
|
+
isInsufficientNetworkTokenForGas(networkBalanceInUSD: string, gasPriceInUSD: number | undefined): boolean;
|
|
15
|
+
isInsufficientSourceTokenForSwap(sourceTokenAmount: string, sourceTokenAddress: string, balance: SwapTokenWithBalance[] | undefined): boolean;
|
|
16
|
+
getToTokenAmount({ sourceToken, toToken, sourceTokenPrice, toTokenPrice, sourceTokenAmount }: {
|
|
17
|
+
sourceToken: SwapTokenWithBalance | undefined;
|
|
18
|
+
toToken: SwapTokenWithBalance | undefined;
|
|
19
|
+
sourceTokenPrice: number;
|
|
20
|
+
toTokenPrice: number;
|
|
21
|
+
sourceTokenAmount: string;
|
|
22
|
+
}): string;
|
|
4
23
|
};
|
|
5
24
|
//# sourceMappingURL=SwapCalculationUtil.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SwapCalculationUtil.d.ts","sourceRoot":"","sources":["../../../src/utils/SwapCalculationUtil.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"SwapCalculationUtil.d.ts","sourceRoot":"","sources":["../../../src/utils/SwapCalculationUtil.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAC;AAGvD,eAAO,MAAM,mBAAmB;4BACN,MAAM,YAAY,MAAM;mCAOjB,MAAM,OAAO,MAAM,YAAY,MAAM;;2BAc/C,MAAM;+BACF,MAAM;2BACV,MAAM;uBACV,MAAM;;6BASE,MAAM,iBAAiB,MAAM;sCAOpB,MAAM;2CAOnB,MAAM,yBACF,MAAM;0DASuB,MAAM,iBAAiB,MAAM,GAAG,SAAS;wDAW1E,MAAM,sBACL,MAAM,WACjB,oBAAoB,EAAE,GAAG,SAAS;;qBAmB9B,oBAAoB,GAAG,SAAS;iBACpC,oBAAoB,GAAG,SAAS;0BACvB,MAAM;sBACV,MAAM;2BACD,MAAM;;CA6C5B,CAAC"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
|
+
/// <reference types="react" />
|
|
2
3
|
import { type EventEmitter } from 'events';
|
|
3
4
|
import type { Balance, SocialProvider, Transaction } from '@reown/appkit-common-react-native';
|
|
4
5
|
export interface BaseError {
|
|
@@ -45,6 +46,11 @@ export type CaipNamespaces = Record<string, {
|
|
|
45
46
|
export type SdkType = 'appkit';
|
|
46
47
|
export type SdkVersion = `react-native-wagmi-${string}` | `react-native-ethers5-${string}` | `react-native-ethers-${string}`;
|
|
47
48
|
export type Features = {
|
|
49
|
+
/**
|
|
50
|
+
* @description Enable or disable the swaps feature. Enabled by default.
|
|
51
|
+
* @type {boolean}
|
|
52
|
+
*/
|
|
53
|
+
swaps?: boolean;
|
|
48
54
|
/**
|
|
49
55
|
* @description Enable or disable the email feature. Enabled by default.
|
|
50
56
|
* @type {boolean}
|
|
@@ -125,6 +131,51 @@ export interface BlockchainApiTransactionsResponse {
|
|
|
125
131
|
data: Transaction[];
|
|
126
132
|
next: string | null;
|
|
127
133
|
}
|
|
134
|
+
export interface BlockchainApiSwapAllowanceResponse {
|
|
135
|
+
allowance: string;
|
|
136
|
+
}
|
|
137
|
+
export interface BlockchainApiGenerateSwapCalldataRequest {
|
|
138
|
+
projectId: string;
|
|
139
|
+
userAddress: string;
|
|
140
|
+
from: string;
|
|
141
|
+
to: string;
|
|
142
|
+
amount: string;
|
|
143
|
+
eip155?: {
|
|
144
|
+
slippage: string;
|
|
145
|
+
permit?: string;
|
|
146
|
+
};
|
|
147
|
+
}
|
|
148
|
+
export interface BlockchainApiGenerateSwapCalldataResponse {
|
|
149
|
+
tx: {
|
|
150
|
+
from: CaipAddress;
|
|
151
|
+
to: CaipAddress;
|
|
152
|
+
data: `0x${string}`;
|
|
153
|
+
amount: string;
|
|
154
|
+
eip155: {
|
|
155
|
+
gas: string;
|
|
156
|
+
gasPrice: string;
|
|
157
|
+
};
|
|
158
|
+
};
|
|
159
|
+
}
|
|
160
|
+
export interface BlockchainApiGenerateApproveCalldataRequest {
|
|
161
|
+
projectId: string;
|
|
162
|
+
userAddress: string;
|
|
163
|
+
from: string;
|
|
164
|
+
to: string;
|
|
165
|
+
amount?: number;
|
|
166
|
+
}
|
|
167
|
+
export interface BlockchainApiGenerateApproveCalldataResponse {
|
|
168
|
+
tx: {
|
|
169
|
+
from: CaipAddress;
|
|
170
|
+
to: CaipAddress;
|
|
171
|
+
data: `0x${string}`;
|
|
172
|
+
value: string;
|
|
173
|
+
eip155: {
|
|
174
|
+
gas: number;
|
|
175
|
+
gasPrice: string;
|
|
176
|
+
};
|
|
177
|
+
};
|
|
178
|
+
}
|
|
128
179
|
export interface BlockchainApiTokenPriceRequest {
|
|
129
180
|
projectId: string;
|
|
130
181
|
currency?: 'usd' | 'eur' | 'gbp' | 'aud' | 'cad' | 'inr' | 'jpy' | 'btc' | 'eth';
|
|
@@ -138,6 +189,11 @@ export interface BlockchainApiTokenPriceResponse {
|
|
|
138
189
|
price: number;
|
|
139
190
|
}[];
|
|
140
191
|
}
|
|
192
|
+
export interface BlockchainApiSwapAllowanceRequest {
|
|
193
|
+
projectId: string;
|
|
194
|
+
tokenAddress: string;
|
|
195
|
+
userAddress: string;
|
|
196
|
+
}
|
|
141
197
|
export interface BlockchainApiGasPriceRequest {
|
|
142
198
|
projectId: string;
|
|
143
199
|
chainId: string;
|
|
@@ -168,6 +224,31 @@ export interface BlockchainApiLookupEnsName {
|
|
|
168
224
|
bio?: string;
|
|
169
225
|
}[];
|
|
170
226
|
}
|
|
227
|
+
export interface BlockchainApiSwapQuoteRequest {
|
|
228
|
+
projectId: string;
|
|
229
|
+
chainId?: string;
|
|
230
|
+
amount: string;
|
|
231
|
+
userAddress: string;
|
|
232
|
+
from: string;
|
|
233
|
+
to: string;
|
|
234
|
+
gasPrice: string;
|
|
235
|
+
}
|
|
236
|
+
export interface BlockchainApiSwapQuoteResponse {
|
|
237
|
+
quotes: {
|
|
238
|
+
id: string | null;
|
|
239
|
+
fromAmount: string;
|
|
240
|
+
fromAccount: string;
|
|
241
|
+
toAmount: string;
|
|
242
|
+
toAccount: string;
|
|
243
|
+
}[];
|
|
244
|
+
}
|
|
245
|
+
export interface BlockchainApiSwapTokensRequest {
|
|
246
|
+
projectId: string;
|
|
247
|
+
chainId?: string;
|
|
248
|
+
}
|
|
249
|
+
export interface BlockchainApiSwapTokensResponse {
|
|
250
|
+
tokens: SwapToken[];
|
|
251
|
+
}
|
|
171
252
|
export interface Token {
|
|
172
253
|
address: string;
|
|
173
254
|
image?: string;
|
|
@@ -338,6 +419,46 @@ export type Event = {
|
|
|
338
419
|
isSmartAccount: boolean;
|
|
339
420
|
network: string;
|
|
340
421
|
};
|
|
422
|
+
} | {
|
|
423
|
+
type: 'track';
|
|
424
|
+
event: 'OPEN_SWAP';
|
|
425
|
+
properties: {
|
|
426
|
+
isSmartAccount: boolean;
|
|
427
|
+
network: string;
|
|
428
|
+
};
|
|
429
|
+
} | {
|
|
430
|
+
type: 'track';
|
|
431
|
+
event: 'INITIATE_SWAP';
|
|
432
|
+
properties: {
|
|
433
|
+
isSmartAccount: boolean;
|
|
434
|
+
network: string;
|
|
435
|
+
swapFromToken: string;
|
|
436
|
+
swapToToken: string;
|
|
437
|
+
swapFromAmount: string;
|
|
438
|
+
swapToAmount: string;
|
|
439
|
+
};
|
|
440
|
+
} | {
|
|
441
|
+
type: 'track';
|
|
442
|
+
event: 'SWAP_SUCCESS';
|
|
443
|
+
properties: {
|
|
444
|
+
isSmartAccount: boolean;
|
|
445
|
+
network: string;
|
|
446
|
+
swapFromToken: string;
|
|
447
|
+
swapToToken: string;
|
|
448
|
+
swapFromAmount: string;
|
|
449
|
+
swapToAmount: string;
|
|
450
|
+
};
|
|
451
|
+
} | {
|
|
452
|
+
type: 'track';
|
|
453
|
+
event: 'SWAP_ERROR';
|
|
454
|
+
properties: {
|
|
455
|
+
isSmartAccount: boolean;
|
|
456
|
+
network: string;
|
|
457
|
+
swapFromToken: string;
|
|
458
|
+
swapToToken: string;
|
|
459
|
+
swapFromAmount: string;
|
|
460
|
+
swapToAmount: string;
|
|
461
|
+
};
|
|
341
462
|
} | {
|
|
342
463
|
type: 'track';
|
|
343
464
|
event: 'SEND_INITIATED';
|
|
@@ -391,6 +512,12 @@ export type Event = {
|
|
|
391
512
|
network: string;
|
|
392
513
|
};
|
|
393
514
|
};
|
|
515
|
+
export type EstimateGasTransactionArgs = {
|
|
516
|
+
chainNamespace?: undefined | 'eip155';
|
|
517
|
+
address: `0x${string}`;
|
|
518
|
+
to: `0x${string}`;
|
|
519
|
+
data: `0x${string}`;
|
|
520
|
+
};
|
|
394
521
|
export interface SendTransactionArgs {
|
|
395
522
|
to: `0x${string}`;
|
|
396
523
|
data: `0x${string}`;
|
|
@@ -398,6 +525,7 @@ export interface SendTransactionArgs {
|
|
|
398
525
|
gas?: bigint;
|
|
399
526
|
gasPrice: bigint;
|
|
400
527
|
address: `0x${string}`;
|
|
528
|
+
chainNamespace?: 'eip155';
|
|
401
529
|
}
|
|
402
530
|
export interface WriteContractArgs {
|
|
403
531
|
receiverAddress: `0x${string}`;
|
|
@@ -407,6 +535,23 @@ export interface WriteContractArgs {
|
|
|
407
535
|
method: 'send' | 'transfer' | 'call';
|
|
408
536
|
abi: any;
|
|
409
537
|
}
|
|
538
|
+
export type SwapToken = {
|
|
539
|
+
name: string;
|
|
540
|
+
symbol: string;
|
|
541
|
+
address: CaipAddress;
|
|
542
|
+
decimals: number;
|
|
543
|
+
logoUri: string;
|
|
544
|
+
eip2612?: boolean;
|
|
545
|
+
};
|
|
546
|
+
export type SwapTokenWithBalance = SwapToken & {
|
|
547
|
+
quantity: {
|
|
548
|
+
decimals: string;
|
|
549
|
+
numeric: string;
|
|
550
|
+
};
|
|
551
|
+
price: number;
|
|
552
|
+
value: number;
|
|
553
|
+
};
|
|
554
|
+
export type SwapInputTarget = 'sourceToken' | 'toToken';
|
|
410
555
|
/**
|
|
411
556
|
* Matches type defined for packages/wallet/src/AppKitFrameProvider.ts
|
|
412
557
|
* It's duplicated in order to decouple scaffold from email package
|
|
@@ -437,8 +582,8 @@ export interface AppKitFrameProvider {
|
|
|
437
582
|
accounts?: {
|
|
438
583
|
type: AppKitFrameAccountType;
|
|
439
584
|
address: string;
|
|
440
|
-
}[]
|
|
441
|
-
userName?: string
|
|
585
|
+
}[];
|
|
586
|
+
userName?: string;
|
|
442
587
|
}>;
|
|
443
588
|
getSocialRedirectUri(payload: {
|
|
444
589
|
provider: SocialProvider;
|
|
@@ -487,7 +632,7 @@ export interface AppKitFrameProvider {
|
|
|
487
632
|
chainId: number | undefined;
|
|
488
633
|
}): Promise<{
|
|
489
634
|
chainId: number;
|
|
490
|
-
email?: string | null
|
|
635
|
+
email?: string | null;
|
|
491
636
|
address: string;
|
|
492
637
|
smartAccountDeployed: boolean;
|
|
493
638
|
preferredAccountType: AppKitFrameAccountType;
|
|
@@ -499,13 +644,14 @@ export interface AppKitFrameProvider {
|
|
|
499
644
|
type: AppKitFrameAccountType;
|
|
500
645
|
address: string;
|
|
501
646
|
}>;
|
|
647
|
+
setOnTimeout(callback: () => void): void;
|
|
502
648
|
getSmartAccountEnabledNetworks(): Promise<{
|
|
503
649
|
smartAccountEnabledNetworks: number[];
|
|
504
650
|
}>;
|
|
505
651
|
disconnect(): Promise<unknown>;
|
|
506
652
|
request(req: any): Promise<any>;
|
|
507
|
-
AuthView: () => JSX.Element | null;
|
|
508
|
-
Webview: () => JSX.Element | null;
|
|
653
|
+
AuthView: () => React.JSX.Element | null;
|
|
654
|
+
Webview: () => React.JSX.Element | null;
|
|
509
655
|
onSetPreferredAccount: (callback: (values: {
|
|
510
656
|
type: AppKitFrameAccountType;
|
|
511
657
|
address: string;
|