@cordystackx/cordy_minikit 3.0.5 → 3.0.10
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/README.md +61 -11
- package/dist/client/runtimeConfig.d.ts +51 -3
- package/dist/client/runtimeConfig.d.ts.map +1 -1
- package/dist/client/runtimeConfig.js +15 -1
- package/dist/client/transfer.d.ts +21 -5
- package/dist/client/transfer.d.ts.map +1 -1
- package/dist/client/transfer.js +423 -72
- package/dist/client.d.ts +1 -1
- package/dist/client.d.ts.map +1 -1
- package/dist/client__provider.d.ts.map +1 -1
- package/dist/client__provider.js +2 -4
- package/dist/components/Connect_wallet_bt.d.ts +3 -3
- package/dist/components/Connect_wallet_bt.d.ts.map +1 -1
- package/dist/components/Connect_wallet_bt.js +13 -13
- package/dist/components/UI_Comp.js +8 -8
- package/dist/config/Image.json +6 -6
- package/dist/controllers/BridgeEvmWalletModal.d.ts +11 -0
- package/dist/controllers/BridgeEvmWalletModal.d.ts.map +1 -0
- package/dist/controllers/BridgeEvmWalletModal.js +154 -0
- package/dist/controllers/Get_Balance.d.ts.map +1 -1
- package/dist/controllers/Get_Balance.js +3 -2
- package/dist/controllers/StellarButton.d.ts.map +1 -1
- package/dist/controllers/StellarButton.js +3 -1
- package/dist/controllers/Transactions.js +2 -2
- package/dist/controllers/bridgeWalletSession.d.ts +13 -0
- package/dist/controllers/bridgeWalletSession.d.ts.map +1 -0
- package/dist/controllers/bridgeWalletSession.js +37 -0
- package/dist/controllers/cctpBridge.d.ts +6 -0
- package/dist/controllers/cctpBridge.d.ts.map +1 -0
- package/dist/controllers/cctpBridge.js +326 -0
- package/dist/controllers/index.d.ts +4 -0
- package/dist/controllers/index.d.ts.map +1 -1
- package/dist/controllers/index.js +2 -0
- package/dist/controllers/useBridgeEvmWallet.d.ts +23 -0
- package/dist/controllers/useBridgeEvmWallet.d.ts.map +1 -0
- package/dist/controllers/useBridgeEvmWallet.js +83 -0
- package/dist/css/UI_Comp/styles.module.css +10 -0
- package/dist/index.d.ts +3 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/package.json +8 -7
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/wagmi__providers.d.ts +2 -2
- package/dist/wagmi__providers.d.ts.map +1 -1
- package/dist/wagmi__providers.js +4 -4
- package/package.json +8 -7
package/README.md
CHANGED
|
@@ -1,12 +1,61 @@
|
|
|
1
1
|
<div align="center">
|
|
2
2
|
<img src="https://raw.githubusercontent.com/cordyStackX/cordy_minikit_official/21cb17b5569b79b29545da80da33d82625e26c7b/assets/cordy-logo.svg" alt="Cordy Minikit logo" width="160" />
|
|
3
3
|
<h1>Cordy Minikit</h1>
|
|
4
|
-
<p>Typed Web3 toolkit for EVM and Stellar/Soroban wallet connections, balances, transfers, and wallet connection checks.</p>
|
|
4
|
+
<p>Typed Web3 toolkit for EVM and Stellar/Soroban wallet connections, balances, transfers, swaps, and wallet connection checks.</p>
|
|
5
5
|
</div>
|
|
6
6
|
|
|
7
|
+
## Configuration highlights
|
|
8
|
+
|
|
9
|
+
EVM networks are declared once under `networks`. ERC-20 assets are grouped by
|
|
10
|
+
chain ID under `evm`; native currencies such as ETH and BOT come from
|
|
11
|
+
`networks[].nativeCurrency` and should not be repeated in `evm`.
|
|
12
|
+
|
|
13
|
+
```json
|
|
14
|
+
{
|
|
15
|
+
"networks": [
|
|
16
|
+
{
|
|
17
|
+
"chainId": 11155111,
|
|
18
|
+
"name": "Ethereum Sepolia",
|
|
19
|
+
"nativeCurrency": { "name": "Sepolia Ether", "symbol": "ETH", "decimals": 18 },
|
|
20
|
+
"rpcUrl": "https://rpc.example"
|
|
21
|
+
}
|
|
22
|
+
],
|
|
23
|
+
"evm": {
|
|
24
|
+
"11155111": [
|
|
25
|
+
{ "symbol": "USDC", "contractAddress": "0xToken", "decimals": 6 }
|
|
26
|
+
]
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
Wallets may connect on another EVM network, but Cordy rejects balance,
|
|
32
|
+
transfer, and swap operations until that chain is configured. Bridge wallet
|
|
33
|
+
connection can prepare the configured route network and request its token in
|
|
34
|
+
wallets that support `wallet_addEthereumChain` and `wallet_watchAsset`.
|
|
35
|
+
|
|
36
|
+
## Configuration map
|
|
37
|
+
|
|
38
|
+
The demo's [`assets.json`](./demo/src/config/assets.json) keeps wallet, network,
|
|
39
|
+
asset, Stellar, and bridge settings in one configuration:
|
|
40
|
+
|
|
41
|
+
```mermaid
|
|
42
|
+
flowchart LR
|
|
43
|
+
config --> project["walletConnectProjectId"]
|
|
44
|
+
config --> networks["networks[]<br/>EVM networks"]
|
|
45
|
+
config --> evm["evm[chainId]<br/>EVM assets"]
|
|
46
|
+
config --> stellarNetwork["stellarNetwork<br/>Stellar connection"]
|
|
47
|
+
config --> stellar["stellar[]<br/>Stellar assets"]
|
|
48
|
+
config --> routes["bridge.routes[]<br/>Bridge routes"]
|
|
49
|
+
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
Native currencies belong to `networks[].nativeCurrency`; ERC-20 contracts
|
|
53
|
+
belong under `evm["<chainId>"]`; bridge directions and contract details belong
|
|
54
|
+
under `bridge.routes[]`.
|
|
55
|
+
|
|
7
56
|
<p align="center">
|
|
8
|
-
<a href="https://badge.socket.dev/npm/package/@cordystackx/cordy_minikit/3.0.
|
|
9
|
-
<img src="https://badge.socket.dev/npm/package/@cordystackx/cordy_minikit/3.0.
|
|
57
|
+
<a href="https://badge.socket.dev/npm/package/@cordystackx/cordy_minikit/3.0.10">
|
|
58
|
+
<img src="https://badge.socket.dev/npm/package/@cordystackx/cordy_minikit/3.0.10" alt="Socket Badge" />
|
|
10
59
|
</a>
|
|
11
60
|
</p>
|
|
12
61
|
|
|
@@ -36,13 +85,13 @@ npm install @cordystackx/cordy_minikit
|
|
|
36
85
|
pnpm add @cordystackx/cordy_minikit
|
|
37
86
|
```
|
|
38
87
|
|
|
39
|
-
## 3.0.
|
|
88
|
+
## 3.0.10 documentation
|
|
40
89
|
|
|
41
90
|
Read the complete documentation in the [`docs/` folder](./docs/README.md):
|
|
42
91
|
|
|
43
92
|
- [Documentation index](https://github.com/cordyStackX/cordy_minikit_official/blob/main/docs/README.md)
|
|
44
93
|
- [Environment configuration](https://github.com/cordyStackX/cordy_minikit_official/blob/main/docs/environment.md)
|
|
45
|
-
- [3.0.
|
|
94
|
+
- [3.0.10 API reference](https://github.com/cordyStackX/cordy_minikit_official/blob/main/docs/api.md)
|
|
46
95
|
- [3.0.0 migration guide](https://github.com/cordyStackX/cordy_minikit_official/blob/main/docs/migration-3.0.0.md)
|
|
47
96
|
- [Provider and wallet UI setup](https://github.com/cordyStackX/cordy_minikit_official/blob/main/docs/setup.md)
|
|
48
97
|
|
|
@@ -57,22 +106,23 @@ const transfer = await cordy.transfer("1", recipient);
|
|
|
57
106
|
await cordy.cons_disconnect();
|
|
58
107
|
```
|
|
59
108
|
|
|
60
|
-
The current 3.0.
|
|
109
|
+
The current 3.0.10 API is:
|
|
61
110
|
|
|
62
111
|
- `cordy.configure({ assets })`
|
|
63
112
|
- `cordy.cons_verify()`
|
|
64
113
|
- `cordy.cons_disconnect()`
|
|
65
114
|
- `cordy.transfer()`
|
|
66
115
|
- `cordy.balance()`
|
|
67
|
-
- `cordy.swap(amount, from, to)`
|
|
116
|
+
- `cordy.swap(amount, from, to, tolerancePercent?, options?)`
|
|
117
|
+
- `cordy.bridge(amount, from, to, recipient, options?)`
|
|
68
118
|
|
|
69
119
|
`cordy.cons_verify()` checks whether an EVM or Stellar wallet is connected in the browser. It returns status `200` when connected and `401` when disconnected; it does not make an HTTP request or authenticate wallet ownership to your server. `cordy.cons_disconnect()` disconnects the wallet locally. Legacy controller helpers remain available for compatibility, but new integrations should use the `cordy.*` API.
|
|
70
120
|
|
|
71
|
-
##
|
|
121
|
+
## Bridge API
|
|
72
122
|
|
|
73
|
-
`cordy.bridge()` is
|
|
123
|
+
`cordy.bridge()` is a supported API in 3.0.10. Configure EVM route pairs in `assets.bridge.routes`; pass `{ routeId }` when more than one route is configured. The demo includes BOT Chain Testnet ↔ Sepolia and BOT Chain Testnet ↔ BNB Testnet. Destination delivery is asynchronous. See the [bridge route configuration](./docs/environment.md#bridge-routes) and [API example](./docs/api.md#cordybridgeamount-from-to-recipient-options).
|
|
74
124
|
|
|
75
|
-
`cordy.swap(amount, from, to, tolerancePercent?)` is available for configured EVM and Stellar assets. EVM networks
|
|
125
|
+
`cordy.swap(amount, from, to, tolerancePercent?, options?)` is available for configured EVM and Stellar assets. EVM networks can configure a V2 `swapRouterAddress`, V3 `swapV3` router and QuoterV2, or both. The default `auto` mode compares configured quotes; use `{ version: "v2" }` or `{ version: "v3" }` to choose explicitly. Pass `feeTiers: [500, 3000]` in the options to override the configured V3 tiers for one call; with `version: "auto"`, V2 is still compared against only those selected V3 tiers. The tiers `500`, `3000`, and `10000` correspond to pool fees of 0.05%, 0.30%, and 1.00%. Every network needs compatible deployments, fee tiers, token addresses, and available liquidity. Native EVM swaps also need `wrappedNativeTokenAddress`. Stellar swaps use Horizon strict-send path payments and require a live liquidity path. The tolerance argument is a percentage: `1` means 1% tolerance, and omission defaults to 1%.
|
|
76
126
|
|
|
77
127
|
## Links
|
|
78
128
|
|
|
@@ -80,4 +130,4 @@ The current 3.0.5 API is:
|
|
|
80
130
|
- [GitHub repository](https://github.com/cordyStackX/cordy_minikit_official)
|
|
81
131
|
- [Changelog](https://github.com/cordyStackX/cordy_minikit_official/blob/main/CHANGELOG.md)
|
|
82
132
|
- [Contributing guide](https://github.com/cordyStackX/cordy_minikit_official/blob/main/CONTRIBUTING.md)
|
|
83
|
-
- [Security policy](https://github.com/cordyStackX/cordy_minikit_official/blob/main/SECURITY.md)
|
|
133
|
+
- [Security policy](https://github.com/cordyStackX/cordy_minikit_official/blob/main/SECURITY.md)
|
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
/** Public app configuration provided to ProvidersClientWrapper as JSON. */
|
|
2
2
|
export type EvmAssetConfig = {
|
|
3
3
|
symbol: string;
|
|
4
|
-
/** Defaults to the first configured EVM network when omitted. */
|
|
5
|
-
chainId?: number;
|
|
6
4
|
type?: "native" | "erc20";
|
|
7
5
|
contractAddress?: string;
|
|
8
6
|
decimals?: number;
|
|
9
7
|
rpcUrl?: string;
|
|
10
8
|
};
|
|
9
|
+
export type EvmAssetRegistry = Record<string, EvmAssetConfig[]>;
|
|
11
10
|
export type EvmNetworkConfig = {
|
|
12
11
|
chainId: number;
|
|
13
12
|
name: string;
|
|
@@ -19,8 +18,50 @@ export type EvmNetworkConfig = {
|
|
|
19
18
|
rpcUrl: string;
|
|
20
19
|
blockExplorerUrl?: string;
|
|
21
20
|
swapRouterAddress?: string;
|
|
21
|
+
/** Optional Uniswap V3-compatible deployment for this chain. */
|
|
22
|
+
swapV3?: {
|
|
23
|
+
routerAddress: string;
|
|
24
|
+
quoterAddress: string;
|
|
25
|
+
feeTiers?: number[];
|
|
26
|
+
/** Defaults to the original Uniswap SwapRouter tuple with a deadline. */
|
|
27
|
+
routerType?: "swapRouter" | "swapRouter02";
|
|
28
|
+
};
|
|
22
29
|
wrappedNativeTokenAddress?: string;
|
|
23
30
|
};
|
|
31
|
+
export type CordyBridgeNetworkConfig = {
|
|
32
|
+
networkType: "evm" | "stellar";
|
|
33
|
+
chainId?: number;
|
|
34
|
+
domain?: number;
|
|
35
|
+
networkName: string;
|
|
36
|
+
bridgeAddress?: string;
|
|
37
|
+
tokenAddress?: string;
|
|
38
|
+
assetSymbol: string;
|
|
39
|
+
tokenMessenger?: string;
|
|
40
|
+
messageTransmitter?: string;
|
|
41
|
+
tokenMessengerMinter?: string;
|
|
42
|
+
cctpForwarder?: string;
|
|
43
|
+
tokenIssuer?: string;
|
|
44
|
+
/** Optional strict minimum: the bridge rejects amounts less than or equal to this value. */
|
|
45
|
+
minimumAmountExclusive?: string;
|
|
46
|
+
stellarMemo?: string;
|
|
47
|
+
};
|
|
48
|
+
export type CordyBridgeConfig = {
|
|
49
|
+
/** Available bridge routes. Configure each supported pair as a separate route. */
|
|
50
|
+
routes?: CordyBridgeRouteConfig[];
|
|
51
|
+
/** Legacy single-route fields; new configurations should use routes. */
|
|
52
|
+
resourceId?: string;
|
|
53
|
+
internal?: CordyBridgeNetworkConfig;
|
|
54
|
+
external?: CordyBridgeNetworkConfig;
|
|
55
|
+
};
|
|
56
|
+
export type CordyBridgeRouteConfig = {
|
|
57
|
+
id: string;
|
|
58
|
+
name: string;
|
|
59
|
+
protocol?: "custom" | "cctp";
|
|
60
|
+
/** Shared bytes32 resource identifier registered by the bridge validators. */
|
|
61
|
+
resourceId?: string;
|
|
62
|
+
internal: CordyBridgeNetworkConfig;
|
|
63
|
+
external: CordyBridgeNetworkConfig;
|
|
64
|
+
};
|
|
24
65
|
export type StellarAssetConfig = {
|
|
25
66
|
symbol: string;
|
|
26
67
|
type: "native";
|
|
@@ -34,6 +75,7 @@ export type StellarAssetConfig = {
|
|
|
34
75
|
};
|
|
35
76
|
export type StellarNetworkConfig = {
|
|
36
77
|
horizonUrl: string;
|
|
78
|
+
sorobanRpcUrl?: string;
|
|
37
79
|
networkPassphrase: string;
|
|
38
80
|
/** Optional Soroban contract ID used by app-specific contract integrations. */
|
|
39
81
|
contractId?: string;
|
|
@@ -41,12 +83,18 @@ export type StellarNetworkConfig = {
|
|
|
41
83
|
export type CordyAssetsConfig = {
|
|
42
84
|
walletConnectProjectId?: string;
|
|
43
85
|
networks?: EvmNetworkConfig[];
|
|
44
|
-
|
|
86
|
+
/** EVM assets grouped by their network chain ID. */
|
|
87
|
+
evm?: EvmAssetRegistry;
|
|
88
|
+
bridge?: CordyBridgeConfig;
|
|
45
89
|
stellarNetwork?: StellarNetworkConfig;
|
|
46
90
|
stellar?: StellarAssetConfig[];
|
|
47
91
|
};
|
|
48
92
|
export declare function setCordyRuntimeConfig(config: CordyAssetsConfig): void;
|
|
49
93
|
export declare function getCordyRuntimeConfig(): CordyAssetsConfig | undefined;
|
|
50
94
|
export declare function isEvmConfigReady(): boolean;
|
|
95
|
+
export declare function getConfiguredEvmAssets(assets: CordyAssetsConfig | undefined): Array<EvmAssetConfig & {
|
|
96
|
+
chainId: number;
|
|
97
|
+
}>;
|
|
98
|
+
export declare function requireConfiguredEvmNetwork(assets: CordyAssetsConfig | undefined, chainId: number, networkName: string): EvmNetworkConfig;
|
|
51
99
|
export declare function isStellarConfigReady(): boolean;
|
|
52
100
|
//# sourceMappingURL=runtimeConfig.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runtimeConfig.d.ts","sourceRoot":"","sources":["../../client/runtimeConfig.ts"],"names":[],"mappings":"AAAA,2EAA2E;AAC3E,MAAM,MAAM,cAAc,GAAG;IAC3B,MAAM,EAAE,MAAM,CAAC;IACf,
|
|
1
|
+
{"version":3,"file":"runtimeConfig.d.ts","sourceRoot":"","sources":["../../client/runtimeConfig.ts"],"names":[],"mappings":"AAAA,2EAA2E;AAC3E,MAAM,MAAM,cAAc,GAAG;IAC3B,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,QAAQ,GAAG,OAAO,CAAC;IAC1B,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF,MAAM,MAAM,gBAAgB,GAAG,MAAM,CAAC,MAAM,EAAE,cAAc,EAAE,CAAC,CAAC;AAEhE,MAAM,MAAM,gBAAgB,GAAG;IAC7B,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC;IACb,cAAc,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAA;KAAE,CAAC;IACnE,MAAM,EAAE,MAAM,CAAC;IACf,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,gEAAg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AAgB,2BAA2B,CACzC,MAAM,EAAE,iBAAiB,GAAG,SAAS,EACrC,OAAO,EAAE,MAAM,EACf,WAAW,EAAE,MAAM,GAClB,gBAAgB,CAUlB;AAED,wBAAgB,oBAAoB,IAAI,OAAO,CAM9C"}
|
|
@@ -6,7 +6,21 @@ export function getCordyRuntimeConfig() {
|
|
|
6
6
|
return activeConfig;
|
|
7
7
|
}
|
|
8
8
|
export function isEvmConfigReady() {
|
|
9
|
-
return Boolean(activeConfig?.networks?.length &&
|
|
9
|
+
return Boolean(activeConfig?.networks?.length &&
|
|
10
|
+
activeConfig.evm &&
|
|
11
|
+
Object.keys(activeConfig.evm).length > 0);
|
|
12
|
+
}
|
|
13
|
+
export function getConfiguredEvmAssets(assets) {
|
|
14
|
+
return Object.entries(assets?.evm ?? {}).flatMap(([chainId, entries]) => entries.map((asset) => ({ ...asset, chainId: Number(chainId) })));
|
|
15
|
+
}
|
|
16
|
+
export function requireConfiguredEvmNetwork(assets, chainId, networkName) {
|
|
17
|
+
const network = assets?.networks?.find((candidate) => candidate.chainId === chainId);
|
|
18
|
+
if (!network) {
|
|
19
|
+
const configured = (assets?.networks ?? []).map((candidate) => `${candidate.name} (${candidate.chainId})`).join(", ");
|
|
20
|
+
throw new Error(`${networkName} (chain ID ${chainId}) is not configured in Cordy Minikit. ` +
|
|
21
|
+
`Add it to assets.networks before using EVM assets. Configured networks: ${configured || "none"}.`);
|
|
22
|
+
}
|
|
23
|
+
return network;
|
|
10
24
|
}
|
|
11
25
|
export function isStellarConfigReady() {
|
|
12
26
|
return Boolean(activeConfig?.stellarNetwork?.horizonUrl &&
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { CordyAssetsConfig } from "./runtimeConfig";
|
|
2
|
-
export type { CordyAssetsConfig, EvmAssetConfig, EvmNetworkConfig, StellarAssetConfig, StellarNetworkConfig } from "./runtimeConfig";
|
|
2
|
+
export type { CordyAssetsConfig, CordyBridgeConfig, CordyBridgeNetworkConfig, CordyBridgeRouteConfig, EvmAssetConfig, EvmAssetRegistry, EvmNetworkConfig, StellarAssetConfig, StellarNetworkConfig } from "./runtimeConfig";
|
|
3
3
|
export type CordyTransferOptions = {
|
|
4
4
|
/** Asset symbol from the configured JSON registry. */
|
|
5
5
|
asset?: string;
|
|
@@ -30,10 +30,22 @@ export type CordySwapResult = {
|
|
|
30
30
|
to?: string;
|
|
31
31
|
amountIn?: string;
|
|
32
32
|
estimatedAmountOut?: string;
|
|
33
|
+
version?: "v2" | "v3";
|
|
34
|
+
feeTier?: number;
|
|
33
35
|
transactionHash?: string;
|
|
34
36
|
error?: string;
|
|
35
37
|
};
|
|
38
|
+
export type CordySwapOptions = {
|
|
39
|
+
/** Select one router family or compare configured V2 and V3 quotes. Defaults to auto. */
|
|
40
|
+
version?: "auto" | "v2" | "v3";
|
|
41
|
+
/** Restrict this call's V3 quote search to these fee tiers. Defaults to the network's configured feeTiers. */
|
|
42
|
+
feeTiers?: number[];
|
|
43
|
+
};
|
|
36
44
|
export type CordyBridgeSide = "internal" | "external";
|
|
45
|
+
export type CordyBridgeOptions = {
|
|
46
|
+
/** Select a configured route. Required when assets.bridge.routes contains multiple routes. */
|
|
47
|
+
routeId?: string;
|
|
48
|
+
};
|
|
37
49
|
export type CordyBridgeResult = {
|
|
38
50
|
success: boolean;
|
|
39
51
|
asset?: string;
|
|
@@ -41,21 +53,25 @@ export type CordyBridgeResult = {
|
|
|
41
53
|
to?: CordyBridgeSide;
|
|
42
54
|
fromNetwork?: string;
|
|
43
55
|
toNetwork?: string;
|
|
56
|
+
routeId?: string;
|
|
57
|
+
routeName?: string;
|
|
44
58
|
amount?: string;
|
|
45
59
|
approvalTransactionHash?: string;
|
|
46
60
|
transactionHash?: string;
|
|
47
|
-
status?: "submitted";
|
|
61
|
+
status?: "submitted" | "pending";
|
|
48
62
|
error?: string;
|
|
63
|
+
errorDetail?: string;
|
|
64
|
+
warning?: string;
|
|
49
65
|
};
|
|
50
66
|
export declare function configureCordyAssets({ assets }: {
|
|
51
67
|
assets: CordyAssetsConfig;
|
|
52
68
|
}): void;
|
|
53
|
-
/** Bridge
|
|
54
|
-
export declare function cordy_bridge(amount: number | string, from: CordyBridgeSide, to: CordyBridgeSide, recipient: string): Promise<CordyBridgeResult>;
|
|
69
|
+
/** Bridge a configured ERC-20 asset between the configured internal and external EVM sides. */
|
|
70
|
+
export declare function cordy_bridge(amount: number | string, from: CordyBridgeSide, to: CordyBridgeSide, recipient: string, options?: CordyBridgeOptions): Promise<CordyBridgeResult>;
|
|
55
71
|
/** Read the full-precision balance for the active wallet and selected asset. */
|
|
56
72
|
export declare function cordy_balance(options?: CordyBalanceOptions): Promise<CordyBalanceResult>;
|
|
57
73
|
/** Swap two configured assets using the active EVM or Stellar wallet. */
|
|
58
|
-
export declare function cordy_swap(amount: number | string, from: string, to: string, tolerancePercent?: number): Promise<CordySwapResult>;
|
|
74
|
+
export declare function cordy_swap(amount: number | string, from: string, to: string, tolerancePercent?: number, options?: CordySwapOptions): Promise<CordySwapResult>;
|
|
59
75
|
/** Configure a caller-owned JSON asset registry before requesting transfers. */
|
|
60
76
|
export declare function cordy_configure(options: {
|
|
61
77
|
assets: CordyAssetsConfig;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transfer.d.ts","sourceRoot":"","sources":["../../client/transfer.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"transfer.d.ts","sourceRoot":"","sources":["../../client/transfer.ts"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAE,iBAAiB,EAAgF,MAAM,iBAAiB,CAAC;AAEvI,YAAY,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,wBAAwB,EAAE,sBAAsB,EAAE,cAAc,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAC;AAK5N,MAAM,MAAM,oBAAoB,GAAG;IACjC,sDAAsD;IACtD,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,I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