@vetro-protocol/gateway 1.2.0 → 1.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/_esm/actions/index.js +49 -20
- package/_esm/actions/index.js.map +7 -1
- package/_esm/chunk-ZE4YZMXK.js +1326 -0
- package/_esm/chunk-ZE4YZMXK.js.map +7 -0
- package/_esm/index.js +57 -30
- package/_esm/index.js.map +7 -1
- package/_types/abi/gatewayAbi.d.ts +34 -0
- package/_types/abi/gatewayAbi.d.ts.map +1 -1
- package/_types/actions/index.d.ts +18 -17
- package/_types/actions/index.d.ts.map +1 -1
- package/_types/actions/public/getGateway.d.ts.map +1 -1
- package/_types/actions/public/getMaxMint.d.ts +5 -0
- package/_types/actions/public/getMaxMint.d.ts.map +1 -0
- package/_types/actions/public/getMaxWithdraw.d.ts.map +1 -1
- package/_types/actions/public/getMintFee.d.ts.map +1 -1
- package/_types/actions/public/getPeggedToken.d.ts.map +1 -1
- package/_types/actions/public/getRedeemFee.d.ts.map +1 -1
- package/_types/actions/public/getRedeemRequest.d.ts.map +1 -1
- package/_types/actions/public/getTreasury.d.ts.map +1 -1
- package/_types/actions/public/getWithdrawalDelay.d.ts.map +1 -1
- package/_types/actions/public/getWithdrawalDelayEnabled.d.ts.map +1 -1
- package/_types/actions/public/index.d.ts +14 -13
- package/_types/actions/public/index.d.ts.map +1 -1
- package/_types/actions/public/isInstantRedeemWhitelisted.d.ts.map +1 -1
- package/_types/actions/public/previewDeposit.d.ts.map +1 -1
- package/_types/actions/public/previewRedeem.d.ts.map +1 -1
- package/_types/actions/public/previewWithdraw.d.ts.map +1 -1
- package/_types/actions/wallet/cancelRedeemRequest.d.ts +1 -1
- package/_types/actions/wallet/deposit.d.ts +1 -1
- package/_types/actions/wallet/redeem.d.ts +1 -1
- package/_types/actions/wallet/requestRedeem.d.ts +1 -1
- package/_types/gatewayAddresses.d.ts.map +1 -1
- package/_types/index.d.ts +13 -12
- package/_types/index.d.ts.map +1 -1
- package/package.json +7 -5
- package/src/abi/gatewayAbi.ts +28 -0
- package/src/actions/index.ts +18 -17
- package/src/actions/public/getGateway.ts +2 -2
- package/src/actions/public/getMaxMint.ts +33 -0
- package/src/actions/public/getMaxWithdraw.ts +2 -2
- package/src/actions/public/getMintFee.ts +2 -2
- package/src/actions/public/getPeggedToken.ts +2 -2
- package/src/actions/public/getRedeemFee.ts +2 -2
- package/src/actions/public/getRedeemRequest.ts +2 -2
- package/src/actions/public/getTreasury.ts +2 -2
- package/src/actions/public/getWithdrawalDelay.ts +2 -2
- package/src/actions/public/getWithdrawalDelayEnabled.ts +2 -2
- package/src/actions/public/index.ts +14 -13
- package/src/actions/public/isInstantRedeemWhitelisted.ts +2 -2
- package/src/actions/public/previewDeposit.ts +2 -2
- package/src/actions/public/previewRedeem.ts +2 -2
- package/src/actions/public/previewWithdraw.ts +2 -2
- package/src/actions/wallet/cancelRedeemRequest.ts +2 -2
- package/src/actions/wallet/deposit.ts +2 -2
- package/src/actions/wallet/redeem.ts +6 -6
- package/src/actions/wallet/requestRedeem.ts +3 -3
- package/src/gatewayAddresses.ts +6 -17
- package/src/index.ts +11 -8
- package/_esm/abi/gatewayAbi.js +0 -195
- package/_esm/abi/gatewayAbi.js.map +0 -1
- package/_esm/abi/peggedTokenAbi.js +0 -10
- package/_esm/abi/peggedTokenAbi.js.map +0 -1
- package/_esm/actions/public/getGateway.js +0 -30
- package/_esm/actions/public/getGateway.js.map +0 -1
- package/_esm/actions/public/getMaxWithdraw.js +0 -28
- package/_esm/actions/public/getMaxWithdraw.js.map +0 -1
- package/_esm/actions/public/getMintFee.js +0 -28
- package/_esm/actions/public/getMintFee.js.map +0 -1
- package/_esm/actions/public/getPeggedToken.js +0 -23
- package/_esm/actions/public/getPeggedToken.js.map +0 -1
- package/_esm/actions/public/getRedeemFee.js +0 -28
- package/_esm/actions/public/getRedeemFee.js.map +0 -1
- package/_esm/actions/public/getRedeemRequest.js +0 -28
- package/_esm/actions/public/getRedeemRequest.js.map +0 -1
- package/_esm/actions/public/getTreasury.js +0 -23
- package/_esm/actions/public/getTreasury.js.map +0 -1
- package/_esm/actions/public/getWithdrawalDelay.js +0 -23
- package/_esm/actions/public/getWithdrawalDelay.js.map +0 -1
- package/_esm/actions/public/getWithdrawalDelayEnabled.js +0 -23
- package/_esm/actions/public/getWithdrawalDelayEnabled.js.map +0 -1
- package/_esm/actions/public/index.js +0 -14
- package/_esm/actions/public/index.js.map +0 -1
- package/_esm/actions/public/isInstantRedeemWhitelisted.js +0 -28
- package/_esm/actions/public/isInstantRedeemWhitelisted.js.map +0 -1
- package/_esm/actions/public/previewDeposit.js +0 -35
- package/_esm/actions/public/previewDeposit.js.map +0 -1
- package/_esm/actions/public/previewRedeem.js +0 -35
- package/_esm/actions/public/previewRedeem.js.map +0 -1
- package/_esm/actions/public/previewWithdraw.js +0 -35
- package/_esm/actions/public/previewWithdraw.js.map +0 -1
- package/_esm/actions/wallet/cancelRedeemRequest.js +0 -89
- package/_esm/actions/wallet/cancelRedeemRequest.js.map +0 -1
- package/_esm/actions/wallet/deposit.js +0 -193
- package/_esm/actions/wallet/deposit.js.map +0 -1
- package/_esm/actions/wallet/redeem.js +0 -226
- package/_esm/actions/wallet/redeem.js.map +0 -1
- package/_esm/actions/wallet/requestRedeem.js +0 -153
- package/_esm/actions/wallet/requestRedeem.js.map +0 -1
- package/_esm/gatewayAddresses.js +0 -18
- package/_esm/gatewayAddresses.js.map +0 -1
- package/_esm/types.js +0 -2
- package/_esm/types.js.map +0 -1
- package/_esm/utils/isAddressValid.js +0 -3
- package/_esm/utils/isAddressValid.js.map +0 -1
- package/_types/utils/isAddressValid.d.ts +0 -3
- package/_types/utils/isAddressValid.d.ts.map +0 -1
- package/src/utils/isAddressValid.ts +0 -4
package/_types/index.d.ts
CHANGED
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
import type { Client, WalletClient } from "viem";
|
|
2
|
-
import { getGateway, getMaxWithdraw, getMintFee, getPeggedToken, getRedeemFee, getRedeemRequest, getTreasury, getWithdrawalDelay, getWithdrawalDelayEnabled, isInstantRedeemWhitelisted, previewDeposit, previewRedeem, previewWithdraw } from "./actions/public/index.
|
|
3
|
-
import { type CancelRedeemRequestParams } from "./actions/wallet/cancelRedeemRequest.
|
|
4
|
-
import { type DepositParams } from "./actions/wallet/deposit.
|
|
5
|
-
import { type RedeemParams } from "./actions/wallet/redeem.
|
|
6
|
-
import { type RequestRedeemParams } from "./actions/wallet/requestRedeem.
|
|
7
|
-
export { gatewayAbi } from "./abi/gatewayAbi.
|
|
8
|
-
export { type Gateway, gatewayAddresses, gateways, } from "./gatewayAddresses.
|
|
2
|
+
import { getGateway, getMaxMint, getMaxWithdraw, getMintFee, getPeggedToken, getRedeemFee, getRedeemRequest, getTreasury, getWithdrawalDelay, getWithdrawalDelayEnabled, isInstantRedeemWhitelisted, previewDeposit, previewRedeem, previewWithdraw } from "./actions/public/index.ts";
|
|
3
|
+
import { type CancelRedeemRequestParams } from "./actions/wallet/cancelRedeemRequest.ts";
|
|
4
|
+
import { type DepositParams } from "./actions/wallet/deposit.ts";
|
|
5
|
+
import { type RedeemParams } from "./actions/wallet/redeem.ts";
|
|
6
|
+
import { type RequestRedeemParams } from "./actions/wallet/requestRedeem.ts";
|
|
7
|
+
export { gatewayAbi } from "./abi/gatewayAbi.ts";
|
|
8
|
+
export { type Gateway, gatewayAddresses, gateways, } from "./gatewayAddresses.ts";
|
|
9
9
|
export type { CancelRedeemRequestParams };
|
|
10
|
-
export { type CancelRedeemRequestEvents, type DepositEvents, type RedeemEvents, type RequestRedeemEvents, } from "./types.
|
|
10
|
+
export { type CancelRedeemRequestEvents, type DepositEvents, type RedeemEvents, type RequestRedeemEvents, } from "./types.ts";
|
|
11
11
|
export declare const gatewayPublicActions: () => (client: Client) => {
|
|
12
12
|
getGateway: (params: Parameters<typeof getGateway>[1]) => Promise<`0x${string}`>;
|
|
13
|
+
getMaxMint: (params: Parameters<typeof getMaxMint>[1]) => Promise<bigint>;
|
|
13
14
|
getMaxWithdraw: (params: Parameters<typeof getMaxWithdraw>[1]) => Promise<bigint>;
|
|
14
15
|
getMintFee: (params: Parameters<typeof getMintFee>[1]) => Promise<bigint>;
|
|
15
16
|
getPeggedToken: (params: Parameters<typeof getPeggedToken>[1]) => Promise<`0x${string}`>;
|
|
@@ -25,19 +26,19 @@ export declare const gatewayPublicActions: () => (client: Client) => {
|
|
|
25
26
|
};
|
|
26
27
|
export declare const gatewayWalletActions: () => (client: WalletClient) => {
|
|
27
28
|
cancelRedeemRequest: (params: CancelRedeemRequestParams) => {
|
|
28
|
-
emitter: import("events")<import("./types.
|
|
29
|
+
emitter: import("events")<import("./types.ts").CancelRedeemRequestEvents>;
|
|
29
30
|
promise: Promise<void>;
|
|
30
31
|
};
|
|
31
32
|
deposit: (params: DepositParams) => {
|
|
32
|
-
emitter: import("events")<import("./types.
|
|
33
|
+
emitter: import("events")<import("./types.ts").DepositEvents>;
|
|
33
34
|
promise: Promise<void>;
|
|
34
35
|
};
|
|
35
36
|
redeem: (params: RedeemParams) => {
|
|
36
|
-
emitter: import("events")<import("./types.
|
|
37
|
+
emitter: import("events")<import("./types.ts").RedeemEvents>;
|
|
37
38
|
promise: Promise<void>;
|
|
38
39
|
};
|
|
39
40
|
requestRedeem: (params: RequestRedeemParams) => {
|
|
40
|
-
emitter: import("events")<import("./types.
|
|
41
|
+
emitter: import("events")<import("./types.ts").RequestRedeemEvents>;
|
|
41
42
|
promise: Promise<void>;
|
|
42
43
|
};
|
|
43
44
|
};
|
package/_types/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,MAAM,CAAC;AAEjD,OAAO,EACL,UAAU,EACV,cAAc,EACd,UAAU,EACV,cAAc,EACd,YAAY,EACZ,gBAAgB,EAChB,WAAW,EACX,kBA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yBAClC,UAAU,CAAC,OAAO,UAAU,CAAC,CAAC,CAAC,CAAC;yBAEhC,UAAU,CAAC,OAAO,UAAU,CAAC,CAAC,CAAC,CAAC;6BAE5B,UAAU,CAAC,OAAO,cAAc,CAAC,CAAC,CAAC,CAAC;yBAExC,UAAU,CAAC,OAAO,UAAU,CAAC,CAAC,CAAC,CAAC;6BAE5B,UAAU,CAAC,OAAO,cAAc,CAAC,CAAC,CAAC,CAAC;2BAEtC,UAAU,CAAC,OAAO,YAAY,CAAC,CAAC,CAAC,CAAC;+BAE9B,UAAU,CAAC,OAAO,gBAAgB,CAAC,CAAC,CAAC,CAAC;0BAE3C,UAAU,CAAC,OAAO,WAAW,CAAC,CAAC,CAAC,CAAC;iCAE1B,UAAU,CAAC,OAAO,kBAAkB,CAAC,CAAC,CAAC,CAAC;wCAG3D,UAAU,CAAC,OAAO,yBAAyB,CAAC,CAAC,CAAC,CAAC;yCAG/C,UAAU,CAAC,OAAO,0BAA0B,CAAC,CAAC,CAAC,CAAC;6BAEjC,UAAU,CAAC,OAAO,cAAc,CAAC,CAAC,CAAC,CAAC;4BAErC,UAAU,CAAC,OAAO,aAAa,CAAC,CAAC,CAAC,CAAC;8BAEjC,UAAU,CAAC,OAAO,eAAe,CAAC,CAAC,CAAC,CAAC;CAE/D,CAAC;AAEH,eAAO,MAAM,oBAAoB,SAAU,QAAQ,YAAY;kCAC/B,yBAAyB;;;;sBAErC,aAAa;;;;qBACd,YAAY;;;;4BACL,mBAAmB;;;;CAC3C,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vetro-protocol/gateway",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.3.1",
|
|
4
4
|
"description": "Vetro Protocol gateway actions for viem.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"files": [
|
|
@@ -17,15 +17,16 @@
|
|
|
17
17
|
},
|
|
18
18
|
"dependencies": {
|
|
19
19
|
"to-promise-event": "1.0.0",
|
|
20
|
-
"viem-erc20": "2.1
|
|
20
|
+
"viem-erc20": "2.2.1"
|
|
21
21
|
},
|
|
22
22
|
"devDependencies": {
|
|
23
23
|
"@tsconfig/node24": "24.0.4",
|
|
24
24
|
"@types/node": "24.1.0",
|
|
25
|
-
"@vitest/coverage-v8": "
|
|
25
|
+
"@vitest/coverage-v8": "5.0.1",
|
|
26
26
|
"typescript": "5.9.3",
|
|
27
27
|
"viem": "2.44.4",
|
|
28
|
-
"vitest": "
|
|
28
|
+
"vitest": "5.0.1",
|
|
29
|
+
"@vetro-protocol/core": "1.0.0"
|
|
29
30
|
},
|
|
30
31
|
"peerDependencies": {
|
|
31
32
|
"viem": "^2.x"
|
|
@@ -53,8 +54,9 @@
|
|
|
53
54
|
"sideEffects": false,
|
|
54
55
|
"scripts": {
|
|
55
56
|
"build": "tsc --noEmit",
|
|
56
|
-
"
|
|
57
|
+
"postbuild": "pnpm bundle && pnpm build:types",
|
|
57
58
|
"build:types": "tsc -p tsconfig.build.json --declarationDir ./_types --emitDeclarationOnly --declaration --declarationMap",
|
|
59
|
+
"bundle": "node ../../scripts/bundle-package.js",
|
|
58
60
|
"clean": "rm -rf ./_esm ./_types",
|
|
59
61
|
"test": "vitest run",
|
|
60
62
|
"test:coverage": "vitest run --coverage"
|
package/src/abi/gatewayAbi.ts
CHANGED
|
@@ -13,6 +13,13 @@ export const gatewayAbi = [
|
|
|
13
13
|
stateMutability: "view",
|
|
14
14
|
type: "function",
|
|
15
15
|
},
|
|
16
|
+
{
|
|
17
|
+
inputs: [],
|
|
18
|
+
name: "mintLimit",
|
|
19
|
+
outputs: [{ type: "uint256" }],
|
|
20
|
+
stateMutability: "view",
|
|
21
|
+
type: "function",
|
|
22
|
+
},
|
|
16
23
|
{
|
|
17
24
|
inputs: [],
|
|
18
25
|
name: "owner",
|
|
@@ -65,6 +72,13 @@ export const gatewayAbi = [
|
|
|
65
72
|
stateMutability: "view",
|
|
66
73
|
type: "function",
|
|
67
74
|
},
|
|
75
|
+
{
|
|
76
|
+
inputs: [],
|
|
77
|
+
name: "maxMint",
|
|
78
|
+
outputs: [{ type: "uint256" }],
|
|
79
|
+
stateMutability: "view",
|
|
80
|
+
type: "function",
|
|
81
|
+
},
|
|
68
82
|
{
|
|
69
83
|
inputs: [{ name: "tokenOut_", type: "address" }],
|
|
70
84
|
name: "maxWithdraw",
|
|
@@ -72,6 +86,13 @@ export const gatewayAbi = [
|
|
|
72
86
|
stateMutability: "view",
|
|
73
87
|
type: "function",
|
|
74
88
|
},
|
|
89
|
+
{
|
|
90
|
+
inputs: [{ name: "account_", type: "address" }],
|
|
91
|
+
name: "addToInstantRedeemWhitelist",
|
|
92
|
+
outputs: [],
|
|
93
|
+
stateMutability: "nonpayable",
|
|
94
|
+
type: "function",
|
|
95
|
+
},
|
|
75
96
|
{
|
|
76
97
|
inputs: [{ name: "account_", type: "address" }],
|
|
77
98
|
name: "removeFromInstantRedeemWhitelist",
|
|
@@ -164,6 +185,13 @@ export const gatewayAbi = [
|
|
|
164
185
|
stateMutability: "nonpayable",
|
|
165
186
|
type: "function",
|
|
166
187
|
},
|
|
188
|
+
{
|
|
189
|
+
inputs: [{ name: "newMintLimit_", type: "uint256" }],
|
|
190
|
+
name: "updateMintLimit",
|
|
191
|
+
outputs: [],
|
|
192
|
+
stateMutability: "nonpayable",
|
|
193
|
+
type: "function",
|
|
194
|
+
},
|
|
167
195
|
{
|
|
168
196
|
inputs: [
|
|
169
197
|
{ name: "token_", type: "address" },
|
package/src/actions/index.ts
CHANGED
|
@@ -1,20 +1,21 @@
|
|
|
1
1
|
// Export all public actions
|
|
2
|
-
export * from "./public/getGateway.
|
|
3
|
-
export * from "./public/
|
|
4
|
-
export * from "./public/
|
|
5
|
-
export * from "./public/
|
|
6
|
-
export * from "./public/
|
|
7
|
-
export * from "./public/
|
|
8
|
-
export * from "./public/
|
|
9
|
-
export * from "./public/
|
|
10
|
-
export * from "./public/
|
|
11
|
-
export * from "./public/
|
|
12
|
-
export * from "./public/
|
|
13
|
-
export * from "./public/
|
|
14
|
-
export * from "./public/
|
|
2
|
+
export * from "./public/getGateway.ts";
|
|
3
|
+
export * from "./public/getMaxMint.ts";
|
|
4
|
+
export * from "./public/getMaxWithdraw.ts";
|
|
5
|
+
export * from "./public/getPeggedToken.ts";
|
|
6
|
+
export * from "./public/getMintFee.ts";
|
|
7
|
+
export * from "./public/getRedeemFee.ts";
|
|
8
|
+
export * from "./public/getRedeemRequest.ts";
|
|
9
|
+
export * from "./public/getTreasury.ts";
|
|
10
|
+
export * from "./public/getWithdrawalDelayEnabled.ts";
|
|
11
|
+
export * from "./public/getWithdrawalDelay.ts";
|
|
12
|
+
export * from "./public/isInstantRedeemWhitelisted.ts";
|
|
13
|
+
export * from "./public/previewDeposit.ts";
|
|
14
|
+
export * from "./public/previewRedeem.ts";
|
|
15
|
+
export * from "./public/previewWithdraw.ts";
|
|
15
16
|
|
|
16
17
|
// Export all wallet actions
|
|
17
|
-
export * from "./wallet/cancelRedeemRequest.
|
|
18
|
-
export * from "./wallet/deposit.
|
|
19
|
-
export * from "./wallet/redeem.
|
|
20
|
-
export * from "./wallet/requestRedeem.
|
|
18
|
+
export * from "./wallet/cancelRedeemRequest.ts";
|
|
19
|
+
export * from "./wallet/deposit.ts";
|
|
20
|
+
export * from "./wallet/redeem.ts";
|
|
21
|
+
export * from "./wallet/requestRedeem.ts";
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
+
import { isAddressValid } from "@vetro-protocol/core";
|
|
1
2
|
import { type Address, type Client } from "viem";
|
|
2
3
|
import { readContract } from "viem/actions";
|
|
3
4
|
|
|
4
|
-
import { peggedTokenAbi } from "../../abi/peggedTokenAbi.
|
|
5
|
-
import { isAddressValid } from "../../utils/isAddressValid.js";
|
|
5
|
+
import { peggedTokenAbi } from "../../abi/peggedTokenAbi.ts";
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* Reads the gateway address for a given pegged token.
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { isAddressValid } from "@vetro-protocol/core";
|
|
2
|
+
import { type Address, type Client } from "viem";
|
|
3
|
+
import { readContract } from "viem/actions";
|
|
4
|
+
|
|
5
|
+
import { gatewayAbi } from "../../abi/gatewayAbi.ts";
|
|
6
|
+
|
|
7
|
+
export async function getMaxMint(
|
|
8
|
+
client: Client,
|
|
9
|
+
parameters: {
|
|
10
|
+
address: Address;
|
|
11
|
+
},
|
|
12
|
+
) {
|
|
13
|
+
// Validate client
|
|
14
|
+
if (!client) {
|
|
15
|
+
throw new Error("Client is not defined");
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
// Validate parameters exist
|
|
19
|
+
if (!parameters) {
|
|
20
|
+
throw new Error("Parameters are required");
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
// Validate gateway address
|
|
24
|
+
if (!isAddressValid(parameters.address)) {
|
|
25
|
+
throw new Error("Gateway is invalid");
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
return readContract(client, {
|
|
29
|
+
abi: gatewayAbi,
|
|
30
|
+
address: parameters.address,
|
|
31
|
+
functionName: "maxMint",
|
|
32
|
+
});
|
|
33
|
+
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
+
import { isAddressValid } from "@vetro-protocol/core";
|
|
1
2
|
import { type Address, type Client } from "viem";
|
|
2
3
|
import { readContract } from "viem/actions";
|
|
3
4
|
|
|
4
|
-
import { gatewayAbi } from "../../abi/gatewayAbi.
|
|
5
|
-
import { isAddressValid } from "../../utils/isAddressValid.js";
|
|
5
|
+
import { gatewayAbi } from "../../abi/gatewayAbi.ts";
|
|
6
6
|
|
|
7
7
|
export async function getMaxWithdraw(
|
|
8
8
|
client: Client,
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
+
import { isAddressValid } from "@vetro-protocol/core";
|
|
1
2
|
import { type Address, type Client } from "viem";
|
|
2
3
|
import { readContract } from "viem/actions";
|
|
3
4
|
|
|
4
|
-
import { gatewayAbi } from "../../abi/gatewayAbi.
|
|
5
|
-
import { isAddressValid } from "../../utils/isAddressValid.js";
|
|
5
|
+
import { gatewayAbi } from "../../abi/gatewayAbi.ts";
|
|
6
6
|
|
|
7
7
|
export async function getMintFee(
|
|
8
8
|
client: Client,
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
+
import { isAddressValid } from "@vetro-protocol/core";
|
|
1
2
|
import { type Address, type Client } from "viem";
|
|
2
3
|
import { readContract } from "viem/actions";
|
|
3
4
|
|
|
4
|
-
import { gatewayAbi } from "../../abi/gatewayAbi.
|
|
5
|
-
import { isAddressValid } from "../../utils/isAddressValid.js";
|
|
5
|
+
import { gatewayAbi } from "../../abi/gatewayAbi.ts";
|
|
6
6
|
|
|
7
7
|
export async function getPeggedToken(
|
|
8
8
|
client: Client,
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
+
import { isAddressValid } from "@vetro-protocol/core";
|
|
1
2
|
import { type Address, type Client } from "viem";
|
|
2
3
|
import { readContract } from "viem/actions";
|
|
3
4
|
|
|
4
|
-
import { gatewayAbi } from "../../abi/gatewayAbi.
|
|
5
|
-
import { isAddressValid } from "../../utils/isAddressValid.js";
|
|
5
|
+
import { gatewayAbi } from "../../abi/gatewayAbi.ts";
|
|
6
6
|
|
|
7
7
|
export async function getRedeemFee(
|
|
8
8
|
client: Client,
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
+
import { isAddressValid } from "@vetro-protocol/core";
|
|
1
2
|
import { type Address, type Client } from "viem";
|
|
2
3
|
import { readContract } from "viem/actions";
|
|
3
4
|
|
|
4
|
-
import { gatewayAbi } from "../../abi/gatewayAbi.
|
|
5
|
-
import { isAddressValid } from "../../utils/isAddressValid.js";
|
|
5
|
+
import { gatewayAbi } from "../../abi/gatewayAbi.ts";
|
|
6
6
|
|
|
7
7
|
export async function getRedeemRequest(
|
|
8
8
|
client: Client,
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
+
import { isAddressValid } from "@vetro-protocol/core";
|
|
1
2
|
import { type Address, type Client } from "viem";
|
|
2
3
|
import { readContract } from "viem/actions";
|
|
3
4
|
|
|
4
|
-
import { gatewayAbi } from "../../abi/gatewayAbi.
|
|
5
|
-
import { isAddressValid } from "../../utils/isAddressValid.js";
|
|
5
|
+
import { gatewayAbi } from "../../abi/gatewayAbi.ts";
|
|
6
6
|
|
|
7
7
|
export async function getTreasury(
|
|
8
8
|
client: Client,
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
+
import { isAddressValid } from "@vetro-protocol/core";
|
|
1
2
|
import { type Address, type Client } from "viem";
|
|
2
3
|
import { readContract } from "viem/actions";
|
|
3
4
|
|
|
4
|
-
import { gatewayAbi } from "../../abi/gatewayAbi.
|
|
5
|
-
import { isAddressValid } from "../../utils/isAddressValid.js";
|
|
5
|
+
import { gatewayAbi } from "../../abi/gatewayAbi.ts";
|
|
6
6
|
|
|
7
7
|
export async function getWithdrawalDelay(
|
|
8
8
|
client: Client,
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
+
import { isAddressValid } from "@vetro-protocol/core";
|
|
1
2
|
import { type Address, type Client } from "viem";
|
|
2
3
|
import { readContract } from "viem/actions";
|
|
3
4
|
|
|
4
|
-
import { gatewayAbi } from "../../abi/gatewayAbi.
|
|
5
|
-
import { isAddressValid } from "../../utils/isAddressValid.js";
|
|
5
|
+
import { gatewayAbi } from "../../abi/gatewayAbi.ts";
|
|
6
6
|
|
|
7
7
|
export async function getWithdrawalDelayEnabled(
|
|
8
8
|
client: Client,
|
|
@@ -1,13 +1,14 @@
|
|
|
1
|
-
export * from "./getGateway.
|
|
2
|
-
export * from "./
|
|
3
|
-
export * from "./
|
|
4
|
-
export * from "./
|
|
5
|
-
export * from "./
|
|
6
|
-
export * from "./
|
|
7
|
-
export * from "./
|
|
8
|
-
export * from "./
|
|
9
|
-
export * from "./
|
|
10
|
-
export * from "./
|
|
11
|
-
export * from "./
|
|
12
|
-
export * from "./
|
|
13
|
-
export * from "./
|
|
1
|
+
export * from "./getGateway.ts";
|
|
2
|
+
export * from "./getMaxMint.ts";
|
|
3
|
+
export * from "./getMaxWithdraw.ts";
|
|
4
|
+
export * from "./getMintFee.ts";
|
|
5
|
+
export * from "./getPeggedToken.ts";
|
|
6
|
+
export * from "./getRedeemFee.ts";
|
|
7
|
+
export * from "./getRedeemRequest.ts";
|
|
8
|
+
export * from "./getTreasury.ts";
|
|
9
|
+
export * from "./getWithdrawalDelay.ts";
|
|
10
|
+
export * from "./getWithdrawalDelayEnabled.ts";
|
|
11
|
+
export * from "./isInstantRedeemWhitelisted.ts";
|
|
12
|
+
export * from "./previewDeposit.ts";
|
|
13
|
+
export * from "./previewRedeem.ts";
|
|
14
|
+
export * from "./previewWithdraw.ts";
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
+
import { isAddressValid } from "@vetro-protocol/core";
|
|
1
2
|
import { type Address, type Client } from "viem";
|
|
2
3
|
import { readContract } from "viem/actions";
|
|
3
4
|
|
|
4
|
-
import { gatewayAbi } from "../../abi/gatewayAbi.
|
|
5
|
-
import { isAddressValid } from "../../utils/isAddressValid.js";
|
|
5
|
+
import { gatewayAbi } from "../../abi/gatewayAbi.ts";
|
|
6
6
|
|
|
7
7
|
export async function isInstantRedeemWhitelisted(
|
|
8
8
|
client: Client,
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
+
import { isAddressValid } from "@vetro-protocol/core";
|
|
1
2
|
import { type Address, type Client } from "viem";
|
|
2
3
|
import { readContract } from "viem/actions";
|
|
3
4
|
|
|
4
|
-
import { gatewayAbi } from "../../abi/gatewayAbi.
|
|
5
|
-
import { isAddressValid } from "../../utils/isAddressValid.js";
|
|
5
|
+
import { gatewayAbi } from "../../abi/gatewayAbi.ts";
|
|
6
6
|
|
|
7
7
|
export async function previewDeposit(
|
|
8
8
|
client: Client,
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
+
import { isAddressValid } from "@vetro-protocol/core";
|
|
1
2
|
import { type Address, type Client } from "viem";
|
|
2
3
|
import { readContract } from "viem/actions";
|
|
3
4
|
|
|
4
|
-
import { gatewayAbi } from "../../abi/gatewayAbi.
|
|
5
|
-
import { isAddressValid } from "../../utils/isAddressValid.js";
|
|
5
|
+
import { gatewayAbi } from "../../abi/gatewayAbi.ts";
|
|
6
6
|
|
|
7
7
|
export async function previewRedeem(
|
|
8
8
|
client: Client,
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
+
import { isAddressValid } from "@vetro-protocol/core";
|
|
1
2
|
import { type Address, type Client } from "viem";
|
|
2
3
|
import { readContract } from "viem/actions";
|
|
3
4
|
|
|
4
|
-
import { gatewayAbi } from "../../abi/gatewayAbi.
|
|
5
|
-
import { isAddressValid } from "../../utils/isAddressValid.js";
|
|
5
|
+
import { gatewayAbi } from "../../abi/gatewayAbi.ts";
|
|
6
6
|
|
|
7
7
|
export async function previewWithdraw(
|
|
8
8
|
client: Client,
|
|
@@ -11,8 +11,8 @@ import {
|
|
|
11
11
|
} from "viem";
|
|
12
12
|
import { waitForTransactionReceipt, writeContract } from "viem/actions";
|
|
13
13
|
|
|
14
|
-
import { gatewayAbi } from "../../abi/gatewayAbi.
|
|
15
|
-
import type { CancelRedeemRequestEvents } from "../../types.
|
|
14
|
+
import { gatewayAbi } from "../../abi/gatewayAbi.ts";
|
|
15
|
+
import type { CancelRedeemRequestEvents } from "../../types.ts";
|
|
16
16
|
|
|
17
17
|
export type CancelRedeemRequestParams = {
|
|
18
18
|
gatewayAddress: Address;
|
|
@@ -12,8 +12,8 @@ import {
|
|
|
12
12
|
import { waitForTransactionReceipt, writeContract } from "viem/actions";
|
|
13
13
|
import { allowance, approve } from "viem-erc20/actions";
|
|
14
14
|
|
|
15
|
-
import { gatewayAbi } from "../../abi/gatewayAbi.
|
|
16
|
-
import type { DepositEvents } from "../../types.
|
|
15
|
+
import { gatewayAbi } from "../../abi/gatewayAbi.ts";
|
|
16
|
+
import type { DepositEvents } from "../../types.ts";
|
|
17
17
|
|
|
18
18
|
export type DepositParams = {
|
|
19
19
|
amountIn: bigint;
|
|
@@ -12,12 +12,12 @@ import {
|
|
|
12
12
|
import { waitForTransactionReceipt, writeContract } from "viem/actions";
|
|
13
13
|
import { allowance, approve } from "viem-erc20/actions";
|
|
14
14
|
|
|
15
|
-
import { gatewayAbi } from "../../abi/gatewayAbi.
|
|
16
|
-
import type { RedeemEvents } from "../../types.
|
|
17
|
-
import { getMaxWithdraw } from "../public/getMaxWithdraw.
|
|
18
|
-
import { getPeggedToken } from "../public/getPeggedToken.
|
|
19
|
-
import { getWithdrawalDelayEnabled } from "../public/getWithdrawalDelayEnabled.
|
|
20
|
-
import { isInstantRedeemWhitelisted } from "../public/isInstantRedeemWhitelisted.
|
|
15
|
+
import { gatewayAbi } from "../../abi/gatewayAbi.ts";
|
|
16
|
+
import type { RedeemEvents } from "../../types.ts";
|
|
17
|
+
import { getMaxWithdraw } from "../public/getMaxWithdraw.ts";
|
|
18
|
+
import { getPeggedToken } from "../public/getPeggedToken.ts";
|
|
19
|
+
import { getWithdrawalDelayEnabled } from "../public/getWithdrawalDelayEnabled.ts";
|
|
20
|
+
import { isInstantRedeemWhitelisted } from "../public/isInstantRedeemWhitelisted.ts";
|
|
21
21
|
|
|
22
22
|
export type RedeemParams = {
|
|
23
23
|
approveAmount?: bigint;
|
|
@@ -12,9 +12,9 @@ import {
|
|
|
12
12
|
import { waitForTransactionReceipt, writeContract } from "viem/actions";
|
|
13
13
|
import { allowance, approve } from "viem-erc20/actions";
|
|
14
14
|
|
|
15
|
-
import { gatewayAbi } from "../../abi/gatewayAbi.
|
|
16
|
-
import type { RequestRedeemEvents } from "../../types.
|
|
17
|
-
import { getPeggedToken } from "../public/getPeggedToken.
|
|
15
|
+
import { gatewayAbi } from "../../abi/gatewayAbi.ts";
|
|
16
|
+
import type { RequestRedeemEvents } from "../../types.ts";
|
|
17
|
+
import { getPeggedToken } from "../public/getPeggedToken.ts";
|
|
18
18
|
|
|
19
19
|
export type RequestRedeemParams = {
|
|
20
20
|
approveAmount?: bigint;
|
package/src/gatewayAddresses.ts
CHANGED
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
import {
|
|
2
|
+
gatewayAddresses as coreGatewayAddresses,
|
|
3
|
+
gateways as coreGateways,
|
|
4
|
+
} from "@vetro-protocol/core";
|
|
1
5
|
import type { Address } from "viem";
|
|
2
6
|
|
|
3
7
|
export type Gateway = {
|
|
@@ -7,21 +11,6 @@ export type Gateway = {
|
|
|
7
11
|
pegBaseSymbol: string;
|
|
8
12
|
};
|
|
9
13
|
|
|
10
|
-
|
|
11
|
-
// peg unit (e.g. WBTC/BTC for the vetBTC gateway, USDT/USD for the VUSD gateway),
|
|
12
|
-
// so the USD price for any whitelisted token is `oracle × portal[pegBaseSymbol]`.
|
|
13
|
-
// See `web/src/fetchers/fetchPrices.ts` for the merge.
|
|
14
|
-
export const gateways: Gateway[] = [
|
|
15
|
-
// VUSD
|
|
16
|
-
{
|
|
17
|
-
address: "0xDaD503f8B9d42bb7af3AfC588358D30163e4416F",
|
|
18
|
-
pegBaseSymbol: "USD",
|
|
19
|
-
},
|
|
20
|
-
// vetBTC
|
|
21
|
-
{
|
|
22
|
-
address: "0xCBA2Ffa0AC52d7871a4221a871793Eb788013faB",
|
|
23
|
-
pegBaseSymbol: "BTC",
|
|
24
|
-
},
|
|
25
|
-
];
|
|
14
|
+
export const gateways: Gateway[] = coreGateways;
|
|
26
15
|
|
|
27
|
-
export const gatewayAddresses: Address[] =
|
|
16
|
+
export const gatewayAddresses: Address[] = coreGatewayAddresses;
|
package/src/index.ts
CHANGED
|
@@ -2,6 +2,7 @@ import type { Client, WalletClient } from "viem";
|
|
|
2
2
|
|
|
3
3
|
import {
|
|
4
4
|
getGateway,
|
|
5
|
+
getMaxMint,
|
|
5
6
|
getMaxWithdraw,
|
|
6
7
|
getMintFee,
|
|
7
8
|
getPeggedToken,
|
|
@@ -14,26 +15,26 @@ import {
|
|
|
14
15
|
previewDeposit,
|
|
15
16
|
previewRedeem,
|
|
16
17
|
previewWithdraw,
|
|
17
|
-
} from "./actions/public/index.
|
|
18
|
+
} from "./actions/public/index.ts";
|
|
18
19
|
import {
|
|
19
20
|
type CancelRedeemRequestParams,
|
|
20
21
|
cancelRedeemRequest,
|
|
21
|
-
} from "./actions/wallet/cancelRedeemRequest.
|
|
22
|
-
import { type DepositParams, deposit } from "./actions/wallet/deposit.
|
|
23
|
-
import { type RedeemParams, redeem } from "./actions/wallet/redeem.
|
|
22
|
+
} from "./actions/wallet/cancelRedeemRequest.ts";
|
|
23
|
+
import { type DepositParams, deposit } from "./actions/wallet/deposit.ts";
|
|
24
|
+
import { type RedeemParams, redeem } from "./actions/wallet/redeem.ts";
|
|
24
25
|
import {
|
|
25
26
|
type RequestRedeemParams,
|
|
26
27
|
requestRedeem,
|
|
27
|
-
} from "./actions/wallet/requestRedeem.
|
|
28
|
+
} from "./actions/wallet/requestRedeem.ts";
|
|
28
29
|
|
|
29
30
|
// Export ABI
|
|
30
|
-
export { gatewayAbi } from "./abi/gatewayAbi.
|
|
31
|
+
export { gatewayAbi } from "./abi/gatewayAbi.ts";
|
|
31
32
|
// Export gateway addresses and per-gateway peg-base metadata
|
|
32
33
|
export {
|
|
33
34
|
type Gateway,
|
|
34
35
|
gatewayAddresses,
|
|
35
36
|
gateways,
|
|
36
|
-
} from "./gatewayAddresses.
|
|
37
|
+
} from "./gatewayAddresses.ts";
|
|
37
38
|
|
|
38
39
|
export type { CancelRedeemRequestParams };
|
|
39
40
|
|
|
@@ -42,12 +43,14 @@ export {
|
|
|
42
43
|
type DepositEvents,
|
|
43
44
|
type RedeemEvents,
|
|
44
45
|
type RequestRedeemEvents,
|
|
45
|
-
} from "./types.
|
|
46
|
+
} from "./types.ts";
|
|
46
47
|
|
|
47
48
|
// Export factory functions for .extend() pattern
|
|
48
49
|
export const gatewayPublicActions = () => (client: Client) => ({
|
|
49
50
|
getGateway: (params: Parameters<typeof getGateway>[1]) =>
|
|
50
51
|
getGateway(client, params),
|
|
52
|
+
getMaxMint: (params: Parameters<typeof getMaxMint>[1]) =>
|
|
53
|
+
getMaxMint(client, params),
|
|
51
54
|
getMaxWithdraw: (params: Parameters<typeof getMaxWithdraw>[1]) =>
|
|
52
55
|
getMaxWithdraw(client, params),
|
|
53
56
|
getMintFee: (params: Parameters<typeof getMintFee>[1]) =>
|