@vetro-protocol/gateway 1.0.0-beta
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/LICENSE +21 -0
- package/README.md +106 -0
- package/_esm/abi/gatewayAbi.js +185 -0
- package/_esm/abi/gatewayAbi.js.map +1 -0
- package/_esm/actions/index.js +18 -0
- package/_esm/actions/index.js.map +1 -0
- package/_esm/actions/public/getMaxWithdraw.js +28 -0
- package/_esm/actions/public/getMaxWithdraw.js.map +1 -0
- package/_esm/actions/public/getMintFee.js +28 -0
- package/_esm/actions/public/getMintFee.js.map +1 -0
- package/_esm/actions/public/getPeggedToken.js +23 -0
- package/_esm/actions/public/getPeggedToken.js.map +1 -0
- package/_esm/actions/public/getRedeemFee.js +28 -0
- package/_esm/actions/public/getRedeemFee.js.map +1 -0
- package/_esm/actions/public/getRedeemRequest.js +28 -0
- package/_esm/actions/public/getRedeemRequest.js.map +1 -0
- package/_esm/actions/public/getTreasury.js +23 -0
- package/_esm/actions/public/getTreasury.js.map +1 -0
- package/_esm/actions/public/getWithdrawalDelay.js +23 -0
- package/_esm/actions/public/getWithdrawalDelay.js.map +1 -0
- package/_esm/actions/public/getWithdrawalDelayEnabled.js +23 -0
- package/_esm/actions/public/getWithdrawalDelayEnabled.js.map +1 -0
- package/_esm/actions/public/index.js +12 -0
- package/_esm/actions/public/index.js.map +1 -0
- package/_esm/actions/public/isInstantRedeemWhitelisted.js +28 -0
- package/_esm/actions/public/isInstantRedeemWhitelisted.js.map +1 -0
- package/_esm/actions/public/previewDeposit.js +35 -0
- package/_esm/actions/public/previewDeposit.js.map +1 -0
- package/_esm/actions/public/previewRedeem.js +35 -0
- package/_esm/actions/public/previewRedeem.js.map +1 -0
- package/_esm/actions/wallet/cancelRedeemRequest.js +89 -0
- package/_esm/actions/wallet/cancelRedeemRequest.js.map +1 -0
- package/_esm/actions/wallet/deposit.js +193 -0
- package/_esm/actions/wallet/deposit.js.map +1 -0
- package/_esm/actions/wallet/redeem.js +226 -0
- package/_esm/actions/wallet/redeem.js.map +1 -0
- package/_esm/actions/wallet/requestRedeem.js +153 -0
- package/_esm/actions/wallet/requestRedeem.js.map +1 -0
- package/_esm/gatewayAddresses.js +18 -0
- package/_esm/gatewayAddresses.js.map +1 -0
- package/_esm/index.js +30 -0
- package/_esm/index.js.map +1 -0
- package/_esm/types.js +2 -0
- package/_esm/types.js.map +1 -0
- package/_esm/utils/isAddressValid.js +3 -0
- package/_esm/utils/isAddressValid.js.map +1 -0
- package/_types/abi/gatewayAbi.d.ts +252 -0
- package/_types/abi/gatewayAbi.d.ts.map +1 -0
- package/_types/actions/index.d.ts +16 -0
- package/_types/actions/index.d.ts.map +1 -0
- package/_types/actions/public/getMaxWithdraw.d.ts +6 -0
- package/_types/actions/public/getMaxWithdraw.d.ts.map +1 -0
- package/_types/actions/public/getMintFee.d.ts +6 -0
- package/_types/actions/public/getMintFee.d.ts.map +1 -0
- package/_types/actions/public/getPeggedToken.d.ts +5 -0
- package/_types/actions/public/getPeggedToken.d.ts.map +1 -0
- package/_types/actions/public/getRedeemFee.d.ts +6 -0
- package/_types/actions/public/getRedeemFee.d.ts.map +1 -0
- package/_types/actions/public/getRedeemRequest.d.ts +6 -0
- package/_types/actions/public/getRedeemRequest.d.ts.map +1 -0
- package/_types/actions/public/getTreasury.d.ts +5 -0
- package/_types/actions/public/getTreasury.d.ts.map +1 -0
- package/_types/actions/public/getWithdrawalDelay.d.ts +5 -0
- package/_types/actions/public/getWithdrawalDelay.d.ts.map +1 -0
- package/_types/actions/public/getWithdrawalDelayEnabled.d.ts +5 -0
- package/_types/actions/public/getWithdrawalDelayEnabled.d.ts.map +1 -0
- package/_types/actions/public/index.d.ts +12 -0
- package/_types/actions/public/index.d.ts.map +1 -0
- package/_types/actions/public/isInstantRedeemWhitelisted.d.ts +6 -0
- package/_types/actions/public/isInstantRedeemWhitelisted.d.ts.map +1 -0
- package/_types/actions/public/previewDeposit.d.ts +7 -0
- package/_types/actions/public/previewDeposit.d.ts.map +1 -0
- package/_types/actions/public/previewRedeem.d.ts +7 -0
- package/_types/actions/public/previewRedeem.d.ts.map +1 -0
- package/_types/actions/wallet/cancelRedeemRequest.d.ts +14 -0
- package/_types/actions/wallet/cancelRedeemRequest.d.ts.map +1 -0
- package/_types/actions/wallet/deposit.d.ts +19 -0
- package/_types/actions/wallet/deposit.d.ts.map +1 -0
- package/_types/actions/wallet/redeem.d.ts +24 -0
- package/_types/actions/wallet/redeem.d.ts.map +1 -0
- package/_types/actions/wallet/requestRedeem.d.ts +18 -0
- package/_types/actions/wallet/requestRedeem.d.ts.map +1 -0
- package/_types/gatewayAddresses.d.ts +8 -0
- package/_types/gatewayAddresses.d.ts.map +1 -0
- package/_types/index.d.ts +42 -0
- package/_types/index.d.ts.map +1 -0
- package/_types/types.d.ts +53 -0
- package/_types/types.d.ts.map +1 -0
- package/_types/utils/isAddressValid.d.ts +3 -0
- package/_types/utils/isAddressValid.d.ts.map +1 -0
- package/package.json +59 -0
- package/src/abi/gatewayAbi.ts +184 -0
- package/src/actions/index.ts +18 -0
- package/src/actions/public/getMaxWithdraw.ts +40 -0
- package/src/actions/public/getMintFee.ts +40 -0
- package/src/actions/public/getPeggedToken.ts +33 -0
- package/src/actions/public/getRedeemFee.ts +40 -0
- package/src/actions/public/getRedeemRequest.ts +40 -0
- package/src/actions/public/getTreasury.ts +33 -0
- package/src/actions/public/getWithdrawalDelay.ts +33 -0
- package/src/actions/public/getWithdrawalDelayEnabled.ts +33 -0
- package/src/actions/public/index.ts +11 -0
- package/src/actions/public/isInstantRedeemWhitelisted.ts +40 -0
- package/src/actions/public/previewDeposit.ts +49 -0
- package/src/actions/public/previewRedeem.ts +49 -0
- package/src/actions/wallet/cancelRedeemRequest.ts +135 -0
- package/src/actions/wallet/deposit.ts +277 -0
- package/src/actions/wallet/redeem.ts +321 -0
- package/src/actions/wallet/requestRedeem.ts +226 -0
- package/src/gatewayAddresses.ts +27 -0
- package/src/index.ts +79 -0
- package/src/types.ts +60 -0
- package/src/utils/isAddressValid.ts +4 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Hemi Labs
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
# @vetro-protocol/gateway
|
|
2
|
+
|
|
3
|
+
Vetro Protocol gateway actions for viem. Wraps the VUSD and vetBTC gateways with `deposit` / `redeem` / `requestRedeem` / `cancelRedeemRequest` flows, ERC20 approval included.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```sh
|
|
8
|
+
pnpm add @vetro-protocol/gateway viem viem-erc20
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Gateway addresses
|
|
12
|
+
|
|
13
|
+
The package exports the canonical gateway addresses and their peg-base metadata:
|
|
14
|
+
|
|
15
|
+
```ts
|
|
16
|
+
import { gatewayAddresses, gateways } from "@vetro-protocol/gateway";
|
|
17
|
+
|
|
18
|
+
// gateways is an array of { address, pegBaseSymbol } entries:
|
|
19
|
+
// { address: "0xDaD5…16F", pegBaseSymbol: "USD" } // VUSD
|
|
20
|
+
// { address: "0xCBA2…faB", pegBaseSymbol: "BTC" } // vetBTC
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
Pass the address you want directly as `gatewayAddress` to any wallet action.
|
|
24
|
+
|
|
25
|
+
## Usage
|
|
26
|
+
|
|
27
|
+
```ts
|
|
28
|
+
import { deposit, getMintFee } from "@vetro-protocol/gateway/actions";
|
|
29
|
+
import { gateways } from "@vetro-protocol/gateway";
|
|
30
|
+
import { createPublicClient, createWalletClient, custom, http } from "viem";
|
|
31
|
+
import { mainnet } from "viem/chains";
|
|
32
|
+
|
|
33
|
+
const publicClient = createPublicClient({ chain: mainnet, transport: http() });
|
|
34
|
+
const walletClient = createWalletClient({
|
|
35
|
+
chain: mainnet,
|
|
36
|
+
transport: custom(window.ethereum),
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
const vusdGateway = gateways.find((g) => g.pegBaseSymbol === "USD")!.address;
|
|
40
|
+
|
|
41
|
+
// Quote the protocol fee for a given deposit
|
|
42
|
+
const fee = await getMintFee(publicClient, {
|
|
43
|
+
address: vusdGateway,
|
|
44
|
+
amountIn: 1_000_000n,
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
// Deposit collateral, mint the pegged token (approval handled automatically)
|
|
48
|
+
const { emitter, promise } = deposit(walletClient, {
|
|
49
|
+
amountIn: 1_000_000n,
|
|
50
|
+
gatewayAddress: vusdGateway,
|
|
51
|
+
minPeggedTokenOut: 950_000n,
|
|
52
|
+
receiver: "0x...",
|
|
53
|
+
tokenIn: "0x...", // e.g. USDC
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
emitter.on("user-signed-deposit", (hash) => console.log("tx hash:", hash));
|
|
57
|
+
emitter.on("deposit-transaction-succeeded", (receipt) =>
|
|
58
|
+
console.log("minted:", receipt),
|
|
59
|
+
);
|
|
60
|
+
|
|
61
|
+
await promise;
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
The same actions are available via `.extend()` factories (`gatewayPublicActions()`, `gatewayWalletActions()`) for callers who prefer viem's extension pattern.
|
|
65
|
+
|
|
66
|
+
## Redeem model
|
|
67
|
+
|
|
68
|
+
Redeeming the pegged token back to collateral has two modes:
|
|
69
|
+
|
|
70
|
+
- **Instant** — if the account is on the instant-redeem whitelist (or withdrawal delay is disabled), `redeem` settles in one transaction.
|
|
71
|
+
- **Delayed** — otherwise, call `requestRedeem` to open a request, wait for the configured `withdrawalDelay`, then `redeem` claims the collateral. `cancelRedeemRequest` cancels a pending request.
|
|
72
|
+
|
|
73
|
+
Use the public actions to inspect state: `getMintFee`, `getRedeemFee`, `previewDeposit`, `previewRedeem`, `getMaxWithdraw`, `getPeggedToken`, `getTreasury`, `getWithdrawalDelay`, `getWithdrawalDelayEnabled`, `isInstantRedeemWhitelisted`, `getRedeemRequest`.
|
|
74
|
+
|
|
75
|
+
## Events
|
|
76
|
+
|
|
77
|
+
Every wallet action returns `{ emitter, promise }` (via `to-promise-event`). The emitter fires a granular lifecycle:
|
|
78
|
+
|
|
79
|
+
- `pre-approve` → `user-signed-approval` → `approve-transaction-succeeded` / `approve-transaction-reverted` (only when an ERC20 approval is needed)
|
|
80
|
+
- `pre-<action>` → `user-signed-<action>` → `<action>-transaction-succeeded` / `<action>-transaction-reverted`
|
|
81
|
+
- `user-signing-<action>-error` if the user rejects in the wallet
|
|
82
|
+
- `<action>-failed-validation` if input validation fails (payload is a human-readable reason)
|
|
83
|
+
- `unexpected-error` for anything that escapes
|
|
84
|
+
- `<action>-settled` always emitted in the `finally` block
|
|
85
|
+
|
|
86
|
+
Event-map types are exported per action: `DepositEvents`, `RedeemEvents`, `RequestRedeemEvents`, `CancelRedeemRequestEvents`.
|
|
87
|
+
|
|
88
|
+
## API
|
|
89
|
+
|
|
90
|
+
Public actions (take a `Client`):
|
|
91
|
+
|
|
92
|
+
- `getMaxWithdraw`, `getMintFee`, `getPeggedToken`, `getRedeemFee`, `getRedeemRequest`, `getTreasury`, `getWithdrawalDelay`, `getWithdrawalDelayEnabled`, `isInstantRedeemWhitelisted`, `previewDeposit`, `previewRedeem`
|
|
93
|
+
|
|
94
|
+
Wallet actions (take a `WalletClient`, return `{ emitter, promise }`):
|
|
95
|
+
|
|
96
|
+
- `deposit`, `redeem`, `requestRedeem`, `cancelRedeemRequest`
|
|
97
|
+
|
|
98
|
+
Encoders (return ABI-encoded calldata):
|
|
99
|
+
|
|
100
|
+
- `encodeDeposit`, `encodeRedeem`, `encodeRequestRedeem`, `encodeCancelRedeemRequest`
|
|
101
|
+
|
|
102
|
+
Extension factories:
|
|
103
|
+
|
|
104
|
+
- `gatewayPublicActions()`, `gatewayWalletActions()`
|
|
105
|
+
|
|
106
|
+
Also exported: `gatewayAbi`, `gatewayAddresses`, `gateways`, and the `Gateway` type.
|
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
export const gatewayAbi = [
|
|
2
|
+
{
|
|
3
|
+
inputs: [],
|
|
4
|
+
name: "PEGGED_TOKEN",
|
|
5
|
+
outputs: [{ type: "address" }],
|
|
6
|
+
stateMutability: "view",
|
|
7
|
+
type: "function",
|
|
8
|
+
},
|
|
9
|
+
{
|
|
10
|
+
inputs: [{ name: "token_", type: "address" }],
|
|
11
|
+
name: "mintFee",
|
|
12
|
+
outputs: [{ type: "uint256" }],
|
|
13
|
+
stateMutability: "view",
|
|
14
|
+
type: "function",
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
inputs: [],
|
|
18
|
+
name: "owner",
|
|
19
|
+
outputs: [{ type: "address" }],
|
|
20
|
+
stateMutability: "view",
|
|
21
|
+
type: "function",
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
inputs: [{ name: "token_", type: "address" }],
|
|
25
|
+
name: "redeemFee",
|
|
26
|
+
outputs: [{ type: "uint256" }],
|
|
27
|
+
stateMutability: "view",
|
|
28
|
+
type: "function",
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
inputs: [],
|
|
32
|
+
name: "treasury",
|
|
33
|
+
outputs: [{ type: "address" }],
|
|
34
|
+
stateMutability: "view",
|
|
35
|
+
type: "function",
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
inputs: [],
|
|
39
|
+
name: "withdrawalDelayEnabled",
|
|
40
|
+
outputs: [{ type: "bool" }],
|
|
41
|
+
stateMutability: "view",
|
|
42
|
+
type: "function",
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
inputs: [],
|
|
46
|
+
name: "withdrawalDelay",
|
|
47
|
+
outputs: [{ type: "uint256" }],
|
|
48
|
+
stateMutability: "view",
|
|
49
|
+
type: "function",
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
inputs: [{ name: "user_", type: "address" }],
|
|
53
|
+
name: "getRedeemRequest",
|
|
54
|
+
outputs: [
|
|
55
|
+
{ name: "amountLocked", type: "uint256" },
|
|
56
|
+
{ name: "claimableAt", type: "uint256" },
|
|
57
|
+
],
|
|
58
|
+
stateMutability: "view",
|
|
59
|
+
type: "function",
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
inputs: [{ name: "account_", type: "address" }],
|
|
63
|
+
name: "isInstantRedeemWhitelisted",
|
|
64
|
+
outputs: [{ type: "bool" }],
|
|
65
|
+
stateMutability: "view",
|
|
66
|
+
type: "function",
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
inputs: [{ name: "tokenOut_", type: "address" }],
|
|
70
|
+
name: "maxWithdraw",
|
|
71
|
+
outputs: [{ type: "uint256" }],
|
|
72
|
+
stateMutability: "view",
|
|
73
|
+
type: "function",
|
|
74
|
+
},
|
|
75
|
+
{
|
|
76
|
+
inputs: [{ name: "account_", type: "address" }],
|
|
77
|
+
name: "removeFromInstantRedeemWhitelist",
|
|
78
|
+
outputs: [],
|
|
79
|
+
stateMutability: "nonpayable",
|
|
80
|
+
type: "function",
|
|
81
|
+
},
|
|
82
|
+
{
|
|
83
|
+
inputs: [
|
|
84
|
+
{ name: "tokenIn_", type: "address" },
|
|
85
|
+
{ name: "amountIn_", type: "uint256" },
|
|
86
|
+
],
|
|
87
|
+
name: "previewDeposit",
|
|
88
|
+
outputs: [{ type: "uint256" }],
|
|
89
|
+
stateMutability: "view",
|
|
90
|
+
type: "function",
|
|
91
|
+
},
|
|
92
|
+
{
|
|
93
|
+
inputs: [
|
|
94
|
+
{ name: "tokenOut_", type: "address" },
|
|
95
|
+
{ name: "peggedTokenIn_", type: "uint256" },
|
|
96
|
+
],
|
|
97
|
+
name: "previewRedeem",
|
|
98
|
+
outputs: [{ type: "uint256" }],
|
|
99
|
+
stateMutability: "view",
|
|
100
|
+
type: "function",
|
|
101
|
+
},
|
|
102
|
+
{
|
|
103
|
+
inputs: [],
|
|
104
|
+
name: "cancelRedeemRequest",
|
|
105
|
+
outputs: [],
|
|
106
|
+
stateMutability: "nonpayable",
|
|
107
|
+
type: "function",
|
|
108
|
+
},
|
|
109
|
+
{
|
|
110
|
+
inputs: [
|
|
111
|
+
{ name: "tokenIn_", type: "address" },
|
|
112
|
+
{ name: "amountIn_", type: "uint256" },
|
|
113
|
+
{ name: "minPeggedTokenOut_", type: "uint256" },
|
|
114
|
+
{ name: "receiver_", type: "address" },
|
|
115
|
+
],
|
|
116
|
+
name: "deposit",
|
|
117
|
+
outputs: [{ type: "uint256" }],
|
|
118
|
+
stateMutability: "nonpayable",
|
|
119
|
+
type: "function",
|
|
120
|
+
},
|
|
121
|
+
{
|
|
122
|
+
inputs: [
|
|
123
|
+
{ name: "tokenOut_", type: "address" },
|
|
124
|
+
{ name: "peggedTokenIn_", type: "uint256" },
|
|
125
|
+
{ name: "minAmountOut_", type: "uint256" },
|
|
126
|
+
{ name: "receiver_", type: "address" },
|
|
127
|
+
],
|
|
128
|
+
name: "redeem",
|
|
129
|
+
outputs: [{ type: "uint256" }],
|
|
130
|
+
stateMutability: "nonpayable",
|
|
131
|
+
type: "function",
|
|
132
|
+
},
|
|
133
|
+
{
|
|
134
|
+
inputs: [{ name: "peggedTokenAmount_", type: "uint256" }],
|
|
135
|
+
name: "requestRedeem",
|
|
136
|
+
outputs: [],
|
|
137
|
+
stateMutability: "nonpayable",
|
|
138
|
+
type: "function",
|
|
139
|
+
},
|
|
140
|
+
{
|
|
141
|
+
inputs: [{ name: "enabled_", type: "bool" }],
|
|
142
|
+
name: "setWithdrawalDelayEnabled",
|
|
143
|
+
outputs: [],
|
|
144
|
+
stateMutability: "nonpayable",
|
|
145
|
+
type: "function",
|
|
146
|
+
},
|
|
147
|
+
{
|
|
148
|
+
inputs: [
|
|
149
|
+
{ name: "token_", type: "address" },
|
|
150
|
+
{ name: "newMintFee_", type: "uint256" },
|
|
151
|
+
],
|
|
152
|
+
name: "updateMintFee",
|
|
153
|
+
outputs: [],
|
|
154
|
+
stateMutability: "nonpayable",
|
|
155
|
+
type: "function",
|
|
156
|
+
},
|
|
157
|
+
{
|
|
158
|
+
inputs: [
|
|
159
|
+
{ name: "token_", type: "address" },
|
|
160
|
+
{ name: "newRedeemFee_", type: "uint256" },
|
|
161
|
+
],
|
|
162
|
+
name: "updateRedeemFee",
|
|
163
|
+
outputs: [],
|
|
164
|
+
stateMutability: "nonpayable",
|
|
165
|
+
type: "function",
|
|
166
|
+
},
|
|
167
|
+
{
|
|
168
|
+
inputs: [{ name: "newDelay_", type: "uint256" }],
|
|
169
|
+
name: "updateWithdrawalDelay",
|
|
170
|
+
outputs: [],
|
|
171
|
+
stateMutability: "nonpayable",
|
|
172
|
+
type: "function",
|
|
173
|
+
},
|
|
174
|
+
{
|
|
175
|
+
anonymous: false,
|
|
176
|
+
inputs: [
|
|
177
|
+
{ indexed: true, name: "user", type: "address" },
|
|
178
|
+
{ indexed: false, name: "amount", type: "uint256" },
|
|
179
|
+
{ indexed: false, name: "claimableAt", type: "uint256" },
|
|
180
|
+
],
|
|
181
|
+
name: "RedeemRequested",
|
|
182
|
+
type: "event",
|
|
183
|
+
},
|
|
184
|
+
];
|
|
185
|
+
//# sourceMappingURL=gatewayAbi.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gatewayAbi.js","sourceRoot":"","sources":["../../src/abi/gatewayAbi.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,UAAU,GAAG;IACxB;QACE,MAAM,EAAE,EAAE;QACV,IAAI,EAAE,cAAc;QACpB,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC;QAC9B,eAAe,EAAE,MAAM;QACvB,IAAI,EAAE,UAAU;KACjB;IACD;QACE,MAAM,EAAE,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC;QAC7C,IAAI,EAAE,SAAS;QACf,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC;QAC9B,eAAe,EAAE,MAAM;QACvB,IAAI,EAAE,UAAU;KACjB;IACD;QACE,MAAM,EAAE,EAAE;QACV,IAAI,EAAE,OAAO;QACb,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC;QAC9B,eAAe,EAAE,MAAM;QACvB,IAAI,EAAE,UAAU;KACjB;IACD;QACE,MAAM,EAAE,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC;QAC7C,IAAI,EAAE,WAAW;QACjB,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC;QAC9B,eAAe,EAAE,MAAM;QACvB,IAAI,EAAE,UAAU;KACjB;IACD;QACE,MAAM,EAAE,EAAE;QACV,IA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,EAAE,eAAe,EAAE,IAAI,EAAE,SAAS,EAAE;SAC3C;QACD,IAAI,EAAE,iBAAiB;QACvB,OAAO,EAAE,EAAE;QACX,eAAe,EAAE,YAAY;QAC7B,IAAI,EAAE,UAAU;KACjB;IACD;QACE,MAAM,EAAE,CAAC,EAAE,IAAI,EAAE,WAAW,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC;QAChD,IAAI,EAAE,uBAAuB;QAC7B,OAAO,EAAE,EAAE;QACX,eAAe,EAAE,YAAY;QAC7B,IAAI,EAAE,UAAU;KACjB;IACD;QACE,SAAS,EAAE,KAAK;QAChB,MAAM,EAAE;YACN,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,SAAS,EAAE;YAChD,EAAE,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,SAAS,EAAE;YACnD,EAAE,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,aAAa,EAAE,IAAI,EAAE,SAAS,EAAE;SACzD;QACD,IAAI,EAAE,iBAAiB;QACvB,IAAI,EAAE,OAAO;KACd;CACO,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
// Export all public actions
|
|
2
|
+
export * from "./public/getMaxWithdraw.js";
|
|
3
|
+
export * from "./public/getPeggedToken.js";
|
|
4
|
+
export * from "./public/getMintFee.js";
|
|
5
|
+
export * from "./public/getRedeemFee.js";
|
|
6
|
+
export * from "./public/getRedeemRequest.js";
|
|
7
|
+
export * from "./public/getTreasury.js";
|
|
8
|
+
export * from "./public/getWithdrawalDelayEnabled.js";
|
|
9
|
+
export * from "./public/getWithdrawalDelay.js";
|
|
10
|
+
export * from "./public/isInstantRedeemWhitelisted.js";
|
|
11
|
+
export * from "./public/previewDeposit.js";
|
|
12
|
+
export * from "./public/previewRedeem.js";
|
|
13
|
+
// Export all wallet actions
|
|
14
|
+
export * from "./wallet/cancelRedeemRequest.js";
|
|
15
|
+
export * from "./wallet/deposit.js";
|
|
16
|
+
export * from "./wallet/redeem.js";
|
|
17
|
+
export * from "./wallet/requestRedeem.js";
|
|
18
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/actions/index.ts"],"names":[],"mappings":"AAAA,4BAA4B;AAC5B,cAAc,4BAA4B,CAAC;AAC3C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,wBAAwB,CAAC;AACvC,cAAc,0BAA0B,CAAC;AACzC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,yBAAyB,CAAC;AACxC,cAAc,uCAAuC,CAAC;AACtD,cAAc,gCAAgC,CAAC;AAC/C,cAAc,wCAAwC,CAAC;AACvD,cAAc,4BAA4B,CAAC;AAC3C,cAAc,2BAA2B,CAAC;AAE1C,4BAA4B;AAC5B,cAAc,iCAAiC,CAAC;AAChD,cAAc,qBAAqB,CAAC;AACpC,cAAc,oBAAoB,CAAC;AACnC,cAAc,2BAA2B,CAAC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { readContract } from "viem/actions";
|
|
2
|
+
import { gatewayAbi } from "../../abi/gatewayAbi.js";
|
|
3
|
+
import { isAddressValid } from "../../utils/isAddressValid.js";
|
|
4
|
+
export async function getMaxWithdraw(client, parameters) {
|
|
5
|
+
// Validate client
|
|
6
|
+
if (!client) {
|
|
7
|
+
throw new Error("Client is not defined");
|
|
8
|
+
}
|
|
9
|
+
// Validate parameters exist
|
|
10
|
+
if (!parameters) {
|
|
11
|
+
throw new Error("Parameters are required");
|
|
12
|
+
}
|
|
13
|
+
// Validate gateway address
|
|
14
|
+
if (!isAddressValid(parameters.address)) {
|
|
15
|
+
throw new Error("Gateway is invalid");
|
|
16
|
+
}
|
|
17
|
+
// Validate tokenOut address
|
|
18
|
+
if (!isAddressValid(parameters.tokenOut)) {
|
|
19
|
+
throw new Error("Token is invalid");
|
|
20
|
+
}
|
|
21
|
+
return readContract(client, {
|
|
22
|
+
abi: gatewayAbi,
|
|
23
|
+
address: parameters.address,
|
|
24
|
+
args: [parameters.tokenOut],
|
|
25
|
+
functionName: "maxWithdraw",
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
//# sourceMappingURL=getMaxWithdraw.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getMaxWithdraw.js","sourceRoot":"","sources":["../../../src/actions/public/getMaxWithdraw.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAE5C,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AACrD,OAAO,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAE/D,MAAM,CAAC,KAAK,UAAU,cAAc,CAClC,MAAc,EACd,UAGC;IAED,kBAAkB;IAClB,IAAI,CAAC,MAAM,EAAE,CAAC;QACZ,MAAM,IAAI,KAAK,CAAC,uBAAuB,CAAC,CAAC;IAC3C,CAAC;IAED,4BAA4B;IAC5B,IAAI,CAAC,UAAU,EAAE,CAAC;QAChB,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAC;IAC7C,CAAC;IAED,2BAA2B;IAC3B,IAAI,CAAC,cAAc,CAAC,UAAU,CAAC,OAAO,CAAC,EAAE,CAAC;QACxC,MAAM,IAAI,KAAK,CAAC,oBAAoB,CAAC,CAAC;IACxC,CAAC;IAED,4BAA4B;IAC5B,IAAI,CAAC,cAAc,CAAC,UAAU,CAAC,QAAQ,CAAC,EAAE,CAAC;QACzC,MAAM,IAAI,KAAK,CAAC,kBAAkB,CAAC,CAAC;IACtC,CAAC;IAED,OAAO,YAAY,CAAC,MAAM,EAAE;QAC1B,GAAG,EAAE,UAAU;QACf,OAAO,EAAE,UAAU,CAAC,OAAO;QAC3B,IAAI,EAAE,CAAC,UAAU,CAAC,QAAQ,CAAC;QAC3B,YAAY,EAAE,aAAa;KAC5B,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { readContract } from "viem/actions";
|
|
2
|
+
import { gatewayAbi } from "../../abi/gatewayAbi.js";
|
|
3
|
+
import { isAddressValid } from "../../utils/isAddressValid.js";
|
|
4
|
+
export async function getMintFee(client, parameters) {
|
|
5
|
+
// Validate client
|
|
6
|
+
if (!client) {
|
|
7
|
+
throw new Error("Client is not defined");
|
|
8
|
+
}
|
|
9
|
+
// Validate parameters exist
|
|
10
|
+
if (!parameters) {
|
|
11
|
+
throw new Error("Parameters are required");
|
|
12
|
+
}
|
|
13
|
+
// Validate gateway address
|
|
14
|
+
if (!isAddressValid(parameters.address)) {
|
|
15
|
+
throw new Error("Gateway is invalid");
|
|
16
|
+
}
|
|
17
|
+
// Validate token address
|
|
18
|
+
if (!isAddressValid(parameters.token)) {
|
|
19
|
+
throw new Error("Token is invalid");
|
|
20
|
+
}
|
|
21
|
+
return readContract(client, {
|
|
22
|
+
abi: gatewayAbi,
|
|
23
|
+
address: parameters.address,
|
|
24
|
+
args: [parameters.token],
|
|
25
|
+
functionName: "mintFee",
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
//# sourceMappingURL=getMintFee.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getMintFee.js","sourceRoot":"","sources":["../../../src/actions/public/getMintFee.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAE5C,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AACrD,OAAO,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAE/D,MAAM,CAAC,KAAK,UAAU,UAAU,CAC9B,MAAc,EACd,UAGC;IAED,kBAAkB;IAClB,IAAI,CAAC,MAAM,EAAE,CAAC;QACZ,MAAM,IAAI,KAAK,CAAC,uBAAuB,CAAC,CAAC;IAC3C,CAAC;IAED,4BAA4B;IAC5B,IAAI,CAAC,UAAU,EAAE,CAAC;QAChB,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAC;IAC7C,CAAC;IAED,2BAA2B;IAC3B,IAAI,CAAC,cAAc,CAAC,UAAU,CAAC,OAAO,CAAC,EAAE,CAAC;QACxC,MAAM,IAAI,KAAK,CAAC,oBAAoB,CAAC,CAAC;IACxC,CAAC;IAED,yBAAyB;IACzB,IAAI,CAAC,cAAc,CAAC,UAAU,CAAC,KAAK,CAAC,EAAE,CAAC;QACtC,MAAM,IAAI,KAAK,CAAC,kBAAkB,CAAC,CAAC;IACtC,CAAC;IAED,OAAO,YAAY,CAAC,MAAM,EAAE;QAC1B,GAAG,EAAE,UAAU;QACf,OAAO,EAAE,UAAU,CAAC,OAAO;QAC3B,IAAI,EAAE,CAAC,UAAU,CAAC,KAAK,CAAC;QACxB,YAAY,EAAE,SAAS;KACxB,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { readContract } from "viem/actions";
|
|
2
|
+
import { gatewayAbi } from "../../abi/gatewayAbi.js";
|
|
3
|
+
import { isAddressValid } from "../../utils/isAddressValid.js";
|
|
4
|
+
export async function getPeggedToken(client, parameters) {
|
|
5
|
+
// Validate client
|
|
6
|
+
if (!client) {
|
|
7
|
+
throw new Error("Client is not defined");
|
|
8
|
+
}
|
|
9
|
+
// Validate parameters exist
|
|
10
|
+
if (!parameters) {
|
|
11
|
+
throw new Error("Parameters are required");
|
|
12
|
+
}
|
|
13
|
+
// Validate gateway address
|
|
14
|
+
if (!isAddressValid(parameters.address)) {
|
|
15
|
+
throw new Error("Gateway is invalid");
|
|
16
|
+
}
|
|
17
|
+
return readContract(client, {
|
|
18
|
+
abi: gatewayAbi,
|
|
19
|
+
address: parameters.address,
|
|
20
|
+
functionName: "PEGGED_TOKEN",
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
//# sourceMappingURL=getPeggedToken.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getPeggedToken.js","sourceRoot":"","sources":["../../../src/actions/public/getPeggedToken.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAE5C,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AACrD,OAAO,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAE/D,MAAM,CAAC,KAAK,UAAU,cAAc,CAClC,MAAc,EACd,UAEC;IAED,kBAAkB;IAClB,IAAI,CAAC,MAAM,EAAE,CAAC;QACZ,MAAM,IAAI,KAAK,CAAC,uBAAuB,CAAC,CAAC;IAC3C,CAAC;IAED,4BAA4B;IAC5B,IAAI,CAAC,UAAU,EAAE,CAAC;QAChB,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAC;IAC7C,CAAC;IAED,2BAA2B;IAC3B,IAAI,CAAC,cAAc,CAAC,UAAU,CAAC,OAAO,CAAC,EAAE,CAAC;QACxC,MAAM,IAAI,KAAK,CAAC,oBAAoB,CAAC,CAAC;IACxC,CAAC;IAED,OAAO,YAAY,CAAC,MAAM,EAAE;QAC1B,GAAG,EAAE,UAAU;QACf,OAAO,EAAE,UAAU,CAAC,OAAO;QAC3B,YAAY,EAAE,cAAc;KAC7B,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { readContract } from "viem/actions";
|
|
2
|
+
import { gatewayAbi } from "../../abi/gatewayAbi.js";
|
|
3
|
+
import { isAddressValid } from "../../utils/isAddressValid.js";
|
|
4
|
+
export async function getRedeemFee(client, parameters) {
|
|
5
|
+
// Validate client
|
|
6
|
+
if (!client) {
|
|
7
|
+
throw new Error("Client is not defined");
|
|
8
|
+
}
|
|
9
|
+
// Validate parameters exist
|
|
10
|
+
if (!parameters) {
|
|
11
|
+
throw new Error("Parameters are required");
|
|
12
|
+
}
|
|
13
|
+
// Validate gateway address
|
|
14
|
+
if (!isAddressValid(parameters.address)) {
|
|
15
|
+
throw new Error("Gateway is invalid");
|
|
16
|
+
}
|
|
17
|
+
// Validate token address
|
|
18
|
+
if (!isAddressValid(parameters.token)) {
|
|
19
|
+
throw new Error("Token is invalid");
|
|
20
|
+
}
|
|
21
|
+
return readContract(client, {
|
|
22
|
+
abi: gatewayAbi,
|
|
23
|
+
address: parameters.address,
|
|
24
|
+
args: [parameters.token],
|
|
25
|
+
functionName: "redeemFee",
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
//# sourceMappingURL=getRedeemFee.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getRedeemFee.js","sourceRoot":"","sources":["../../../src/actions/public/getRedeemFee.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAE5C,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AACrD,OAAO,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAE/D,MAAM,CAAC,KAAK,UAAU,YAAY,CAChC,MAAc,EACd,UAGC;IAED,kBAAkB;IAClB,IAAI,CAAC,MAAM,EAAE,CAAC;QACZ,MAAM,IAAI,KAAK,CAAC,uBAAuB,CAAC,CAAC;IAC3C,CAAC;IAED,4BAA4B;IAC5B,IAAI,CAAC,UAAU,EAAE,CAAC;QAChB,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAC;IAC7C,CAAC;IAED,2BAA2B;IAC3B,IAAI,CAAC,cAAc,CAAC,UAAU,CAAC,OAAO,CAAC,EAAE,CAAC;QACxC,MAAM,IAAI,KAAK,CAAC,oBAAoB,CAAC,CAAC;IACxC,CAAC;IAED,yBAAyB;IACzB,IAAI,CAAC,cAAc,CAAC,UAAU,CAAC,KAAK,CAAC,EAAE,CAAC;QACtC,MAAM,IAAI,KAAK,CAAC,kBAAkB,CAAC,CAAC;IACtC,CAAC;IAED,OAAO,YAAY,CAAC,MAAM,EAAE;QAC1B,GAAG,EAAE,UAAU;QACf,OAAO,EAAE,UAAU,CAAC,OAAO;QAC3B,IAAI,EAAE,CAAC,UAAU,CAAC,KAAK,CAAC;QACxB,YAAY,EAAE,WAAW;KAC1B,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { readContract } from "viem/actions";
|
|
2
|
+
import { gatewayAbi } from "../../abi/gatewayAbi.js";
|
|
3
|
+
import { isAddressValid } from "../../utils/isAddressValid.js";
|
|
4
|
+
export async function getRedeemRequest(client, parameters) {
|
|
5
|
+
// Validate client
|
|
6
|
+
if (!client) {
|
|
7
|
+
throw new Error("Client is not defined");
|
|
8
|
+
}
|
|
9
|
+
// Validate parameters exist
|
|
10
|
+
if (!parameters) {
|
|
11
|
+
throw new Error("Parameters are required");
|
|
12
|
+
}
|
|
13
|
+
// Validate gateway address
|
|
14
|
+
if (!isAddressValid(parameters.address)) {
|
|
15
|
+
throw new Error("Gateway is invalid");
|
|
16
|
+
}
|
|
17
|
+
// Validate user address
|
|
18
|
+
if (!isAddressValid(parameters.user)) {
|
|
19
|
+
throw new Error("User is invalid");
|
|
20
|
+
}
|
|
21
|
+
return readContract(client, {
|
|
22
|
+
abi: gatewayAbi,
|
|
23
|
+
address: parameters.address,
|
|
24
|
+
args: [parameters.user],
|
|
25
|
+
functionName: "getRedeemRequest",
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
//# sourceMappingURL=getRedeemRequest.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getRedeemRequest.js","sourceRoot":"","sources":["../../../src/actions/public/getRedeemRequest.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAE5C,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AACrD,OAAO,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAE/D,MAAM,CAAC,KAAK,UAAU,gBAAgB,CACpC,MAAc,EACd,UAGC;IAED,kBAAkB;IAClB,IAAI,CAAC,MAAM,EAAE,CAAC;QACZ,MAAM,IAAI,KAAK,CAAC,uBAAuB,CAAC,CAAC;IAC3C,CAAC;IAED,4BAA4B;IAC5B,IAAI,CAAC,UAAU,EAAE,CAAC;QAChB,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAC;IAC7C,CAAC;IAED,2BAA2B;IAC3B,IAAI,CAAC,cAAc,CAAC,UAAU,CAAC,OAAO,CAAC,EAAE,CAAC;QACxC,MAAM,IAAI,KAAK,CAAC,oBAAoB,CAAC,CAAC;IACxC,CAAC;IAED,wBAAwB;IACxB,IAAI,CAAC,cAAc,CAAC,UAAU,CAAC,IAAI,CAAC,EAAE,CAAC;QACrC,MAAM,IAAI,KAAK,CAAC,iBAAiB,CAAC,CAAC;IACrC,CAAC;IAED,OAAO,YAAY,CAAC,MAAM,EAAE;QAC1B,GAAG,EAAE,UAAU;QACf,OAAO,EAAE,UAAU,CAAC,OAAO;QAC3B,IAAI,EAAE,CAAC,UAAU,CAAC,IAAI,CAAC;QACvB,YAAY,EAAE,kBAAkB;KACjC,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { readContract } from "viem/actions";
|
|
2
|
+
import { gatewayAbi } from "../../abi/gatewayAbi.js";
|
|
3
|
+
import { isAddressValid } from "../../utils/isAddressValid.js";
|
|
4
|
+
export async function getTreasury(client, parameters) {
|
|
5
|
+
// Validate client
|
|
6
|
+
if (!client) {
|
|
7
|
+
throw new Error("Client is not defined");
|
|
8
|
+
}
|
|
9
|
+
// Validate parameters exist
|
|
10
|
+
if (!parameters) {
|
|
11
|
+
throw new Error("Parameters are required");
|
|
12
|
+
}
|
|
13
|
+
// Validate gateway address
|
|
14
|
+
if (!isAddressValid(parameters.address)) {
|
|
15
|
+
throw new Error("Gateway is invalid");
|
|
16
|
+
}
|
|
17
|
+
return readContract(client, {
|
|
18
|
+
abi: gatewayAbi,
|
|
19
|
+
address: parameters.address,
|
|
20
|
+
functionName: "treasury",
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
//# sourceMappingURL=getTreasury.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getTreasury.js","sourceRoot":"","sources":["../../../src/actions/public/getTreasury.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAE5C,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AACrD,OAAO,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAE/D,MAAM,CAAC,KAAK,UAAU,WAAW,CAC/B,MAAc,EACd,UAEC;IAED,kBAAkB;IAClB,IAAI,CAAC,MAAM,EAAE,CAAC;QACZ,MAAM,IAAI,KAAK,CAAC,uBAAuB,CAAC,CAAC;IAC3C,CAAC;IAED,4BAA4B;IAC5B,IAAI,CAAC,UAAU,EAAE,CAAC;QAChB,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAC;IAC7C,CAAC;IAED,2BAA2B;IAC3B,IAAI,CAAC,cAAc,CAAC,UAAU,CAAC,OAAO,CAAC,EAAE,CAAC;QACxC,MAAM,IAAI,KAAK,CAAC,oBAAoB,CAAC,CAAC;IACxC,CAAC;IAED,OAAO,YAAY,CAAC,MAAM,EAAE;QAC1B,GAAG,EAAE,UAAU;QACf,OAAO,EAAE,UAAU,CAAC,OAAO;QAC3B,YAAY,EAAE,UAAU;KACzB,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { readContract } from "viem/actions";
|
|
2
|
+
import { gatewayAbi } from "../../abi/gatewayAbi.js";
|
|
3
|
+
import { isAddressValid } from "../../utils/isAddressValid.js";
|
|
4
|
+
export async function getWithdrawalDelay(client, parameters) {
|
|
5
|
+
// Validate client
|
|
6
|
+
if (!client) {
|
|
7
|
+
throw new Error("Client is not defined");
|
|
8
|
+
}
|
|
9
|
+
// Validate parameters exist
|
|
10
|
+
if (!parameters) {
|
|
11
|
+
throw new Error("Parameters are required");
|
|
12
|
+
}
|
|
13
|
+
// Validate gateway address
|
|
14
|
+
if (!isAddressValid(parameters.address)) {
|
|
15
|
+
throw new Error("Gateway is invalid");
|
|
16
|
+
}
|
|
17
|
+
return readContract(client, {
|
|
18
|
+
abi: gatewayAbi,
|
|
19
|
+
address: parameters.address,
|
|
20
|
+
functionName: "withdrawalDelay",
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
//# sourceMappingURL=getWithdrawalDelay.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getWithdrawalDelay.js","sourceRoot":"","sources":["../../../src/actions/public/getWithdrawalDelay.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAE5C,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AACrD,OAAO,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAE/D,MAAM,CAAC,KAAK,UAAU,kBAAkB,CACtC,MAAc,EACd,UAEC;IAED,kBAAkB;IAClB,IAAI,CAAC,MAAM,EAAE,CAAC;QACZ,MAAM,IAAI,KAAK,CAAC,uBAAuB,CAAC,CAAC;IAC3C,CAAC;IAED,4BAA4B;IAC5B,IAAI,CAAC,UAAU,EAAE,CAAC;QAChB,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAC;IAC7C,CAAC;IAED,2BAA2B;IAC3B,IAAI,CAAC,cAAc,CAAC,UAAU,CAAC,OAAO,CAAC,EAAE,CAAC;QACxC,MAAM,IAAI,KAAK,CAAC,oBAAoB,CAAC,CAAC;IACxC,CAAC;IAED,OAAO,YAAY,CAAC,MAAM,EAAE;QAC1B,GAAG,EAAE,UAAU;QACf,OAAO,EAAE,UAAU,CAAC,OAAO;QAC3B,YAAY,EAAE,iBAAiB;KAChC,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { readContract } from "viem/actions";
|
|
2
|
+
import { gatewayAbi } from "../../abi/gatewayAbi.js";
|
|
3
|
+
import { isAddressValid } from "../../utils/isAddressValid.js";
|
|
4
|
+
export async function getWithdrawalDelayEnabled(client, parameters) {
|
|
5
|
+
// Validate client
|
|
6
|
+
if (!client) {
|
|
7
|
+
throw new Error("Client is not defined");
|
|
8
|
+
}
|
|
9
|
+
// Validate parameters exist
|
|
10
|
+
if (!parameters) {
|
|
11
|
+
throw new Error("Parameters are required");
|
|
12
|
+
}
|
|
13
|
+
// Validate gateway address
|
|
14
|
+
if (!isAddressValid(parameters.address)) {
|
|
15
|
+
throw new Error("Gateway is invalid");
|
|
16
|
+
}
|
|
17
|
+
return readContract(client, {
|
|
18
|
+
abi: gatewayAbi,
|
|
19
|
+
address: parameters.address,
|
|
20
|
+
functionName: "withdrawalDelayEnabled",
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
//# sourceMappingURL=getWithdrawalDelayEnabled.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getWithdrawalDelayEnabled.js","sourceRoot":"","sources":["../../../src/actions/public/getWithdrawalDelayEnabled.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAE5C,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AACrD,OAAO,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAE/D,MAAM,CAAC,KAAK,UAAU,yBAAyB,CAC7C,MAAc,EACd,UAEC;IAED,kBAAkB;IAClB,IAAI,CAAC,MAAM,EAAE,CAAC;QACZ,MAAM,IAAI,KAAK,CAAC,uBAAuB,CAAC,CAAC;IAC3C,CAAC;IAED,4BAA4B;IAC5B,IAAI,CAAC,UAAU,EAAE,CAAC;QAChB,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAC;IAC7C,CAAC;IAED,2BAA2B;IAC3B,IAAI,CAAC,cAAc,CAAC,UAAU,CAAC,OAAO,CAAC,EAAE,CAAC;QACxC,MAAM,IAAI,KAAK,CAAC,oBAAoB,CAAC,CAAC;IACxC,CAAC;IAED,OAAO,YAAY,CAAC,MAAM,EAAE;QAC1B,GAAG,EAAE,UAAU;QACf,OAAO,EAAE,UAAU,CAAC,OAAO;QAC3B,YAAY,EAAE,wBAAwB;KACvC,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export * from "./getMaxWithdraw.js";
|
|
2
|
+
export * from "./getMintFee.js";
|
|
3
|
+
export * from "./getPeggedToken.js";
|
|
4
|
+
export * from "./getRedeemFee.js";
|
|
5
|
+
export * from "./getRedeemRequest.js";
|
|
6
|
+
export * from "./getTreasury.js";
|
|
7
|
+
export * from "./getWithdrawalDelay.js";
|
|
8
|
+
export * from "./getWithdrawalDelayEnabled.js";
|
|
9
|
+
export * from "./isInstantRedeemWhitelisted.js";
|
|
10
|
+
export * from "./previewDeposit.js";
|
|
11
|
+
export * from "./previewRedeem.js";
|
|
12
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/actions/public/index.ts"],"names":[],"mappings":"AAAA,cAAc,qBAAqB,CAAC;AACpC,cAAc,iBAAiB,CAAC;AAChC,cAAc,qBAAqB,CAAC;AACpC,cAAc,mBAAmB,CAAC;AAClC,cAAc,uBAAuB,CAAC;AACtC,cAAc,kBAAkB,CAAC;AACjC,cAAc,yBAAyB,CAAC;AACxC,cAAc,gCAAgC,CAAC;AAC/C,cAAc,iCAAiC,CAAC;AAChD,cAAc,qBAAqB,CAAC;AACpC,cAAc,oBAAoB,CAAC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { readContract } from "viem/actions";
|
|
2
|
+
import { gatewayAbi } from "../../abi/gatewayAbi.js";
|
|
3
|
+
import { isAddressValid } from "../../utils/isAddressValid.js";
|
|
4
|
+
export async function isInstantRedeemWhitelisted(client, parameters) {
|
|
5
|
+
// Validate client
|
|
6
|
+
if (!client) {
|
|
7
|
+
throw new Error("Client is not defined");
|
|
8
|
+
}
|
|
9
|
+
// Validate parameters exist
|
|
10
|
+
if (!parameters) {
|
|
11
|
+
throw new Error("Parameters are required");
|
|
12
|
+
}
|
|
13
|
+
// Validate gateway address
|
|
14
|
+
if (!isAddressValid(parameters.address)) {
|
|
15
|
+
throw new Error("Gateway is invalid");
|
|
16
|
+
}
|
|
17
|
+
// Validate account address
|
|
18
|
+
if (!isAddressValid(parameters.account)) {
|
|
19
|
+
throw new Error("Account is invalid");
|
|
20
|
+
}
|
|
21
|
+
return readContract(client, {
|
|
22
|
+
abi: gatewayAbi,
|
|
23
|
+
address: parameters.address,
|
|
24
|
+
args: [parameters.account],
|
|
25
|
+
functionName: "isInstantRedeemWhitelisted",
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
//# sourceMappingURL=isInstantRedeemWhitelisted.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"isInstantRedeemWhitelisted.js","sourceRoot":"","sources":["../../../src/actions/public/isInstantRedeemWhitelisted.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAE5C,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AACrD,OAAO,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAE/D,MAAM,CAAC,KAAK,UAAU,0BAA0B,CAC9C,MAAc,EACd,UAGC;IAED,kBAAkB;IAClB,IAAI,CAAC,MAAM,EAAE,CAAC;QACZ,MAAM,IAAI,KAAK,CAAC,uBAAuB,CAAC,CAAC;IAC3C,CAAC;IAED,4BAA4B;IAC5B,IAAI,CAAC,UAAU,EAAE,CAAC;QAChB,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAC;IAC7C,CAAC;IAED,2BAA2B;IAC3B,IAAI,CAAC,cAAc,CAAC,UAAU,CAAC,OAAO,CAAC,EAAE,CAAC;QACxC,MAAM,IAAI,KAAK,CAAC,oBAAoB,CAAC,CAAC;IACxC,CAAC;IAED,2BAA2B;IAC3B,IAAI,CAAC,cAAc,CAAC,UAAU,CAAC,OAAO,CAAC,EAAE,CAAC;QACxC,MAAM,IAAI,KAAK,CAAC,oBAAoB,CAAC,CAAC;IACxC,CAAC;IAED,OAAO,YAAY,CAAC,MAAM,EAAE;QAC1B,GAAG,EAAE,UAAU;QACf,OAAO,EAAE,UAAU,CAAC,OAAO;QAC3B,IAAI,EAAE,CAAC,UAAU,CAAC,OAAO,CAAC;QAC1B,YAAY,EAAE,4BAA4B;KAC3C,CAAC,CAAC;AACL,CAAC"}
|