@paxoslabs/amplify-sdk 0.5.2 → 1.0.0
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/dist/index.d.mts +3158 -725
- package/dist/index.d.ts +3158 -725
- package/dist/index.js +15013 -171
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +15067 -6
- package/dist/index.mjs.map +1 -1
- package/package.json +25 -86
- package/CHANGELOG.md +0 -320
- package/LICENSE +0 -28
- package/README.md +0 -119
- package/dist/chain-utils-BdJecHBA.d.mts +0 -334
- package/dist/chain-utils-BdJecHBA.d.ts +0 -334
- package/dist/chunk-5OK753GA.js +0 -1989
- package/dist/chunk-5OK753GA.js.map +0 -1
- package/dist/chunk-6CU533DM.mjs +0 -39
- package/dist/chunk-6CU533DM.mjs.map +0 -1
- package/dist/chunk-7JQQ2TH4.mjs +0 -1231
- package/dist/chunk-7JQQ2TH4.mjs.map +0 -1
- package/dist/chunk-HU5CTL4C.mjs +0 -1962
- package/dist/chunk-HU5CTL4C.mjs.map +0 -1
- package/dist/chunk-NNDY5TID.js +0 -1143
- package/dist/chunk-NNDY5TID.js.map +0 -1
- package/dist/chunk-Q5FXJU5Y.mjs +0 -1133
- package/dist/chunk-Q5FXJU5Y.mjs.map +0 -1
- package/dist/chunk-QZHI2T7O.mjs +0 -457
- package/dist/chunk-QZHI2T7O.mjs.map +0 -1
- package/dist/chunk-SWUG4PTB.js +0 -464
- package/dist/chunk-SWUG4PTB.js.map +0 -1
- package/dist/chunk-TNL23CO2.js +0 -45
- package/dist/chunk-TNL23CO2.js.map +0 -1
- package/dist/chunk-WK7EJRBB.mjs +0 -1482
- package/dist/chunk-WK7EJRBB.mjs.map +0 -1
- package/dist/chunk-WYBYBPX5.js +0 -1518
- package/dist/chunk-WYBYBPX5.js.map +0 -1
- package/dist/chunk-ZKDXRGI5.js +0 -1239
- package/dist/chunk-ZKDXRGI5.js.map +0 -1
- package/dist/core.d.mts +0 -152
- package/dist/core.d.ts +0 -152
- package/dist/core.js +0 -1220
- package/dist/core.js.map +0 -1
- package/dist/core.mjs +0 -1194
- package/dist/core.mjs.map +0 -1
- package/dist/display.d.mts +0 -263
- package/dist/display.d.ts +0 -263
- package/dist/display.js +0 -36
- package/dist/display.js.map +0 -1
- package/dist/display.mjs +0 -7
- package/dist/display.mjs.map +0 -1
- package/dist/index-DXXA8gEA.d.mts +0 -5026
- package/dist/index-aE5lTOUH.d.ts +0 -5026
- package/dist/utils.d.mts +0 -112
- package/dist/utils.d.ts +0 -112
- package/dist/utils.js +0 -67
- package/dist/utils.js.map +0 -1
- package/dist/utils.mjs +0 -25
- package/dist/utils.mjs.map +0 -1
- package/dist/vaults.d.mts +0 -4
- package/dist/vaults.d.ts +0 -4
- package/dist/vaults.js +0 -96
- package/dist/vaults.js.map +0 -1
- package/dist/vaults.mjs +0 -7
- package/dist/vaults.mjs.map +0 -1
package/dist/utils.d.mts
DELETED
|
@@ -1,112 +0,0 @@
|
|
|
1
|
-
export { C as ChainId, c as clearChainsCache, g as getChainFromConfig, t as toChainId } from './chain-utils-BdJecHBA.mjs';
|
|
2
|
-
import 'viem/chains';
|
|
3
|
-
import 'viem';
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* RAY precision unit (10^27)
|
|
7
|
-
* Used for high precision fixed-point calculations
|
|
8
|
-
* @type {{bigint: bigint, number: number}}
|
|
9
|
-
*/
|
|
10
|
-
declare const RAY: {
|
|
11
|
-
bigint: bigint;
|
|
12
|
-
number: number;
|
|
13
|
-
};
|
|
14
|
-
/**
|
|
15
|
-
* WAD precision unit (10^18)
|
|
16
|
-
* Common precision unit for Ethereum tokens (matches ETH's 18 decimals)
|
|
17
|
-
* @type {{bigint: bigint, number: number}}
|
|
18
|
-
*/
|
|
19
|
-
declare const WAD: {
|
|
20
|
-
bigint: bigint;
|
|
21
|
-
number: number;
|
|
22
|
-
};
|
|
23
|
-
/**
|
|
24
|
-
* Converts a bigint value to a formatted number string with specified decimal precision
|
|
25
|
-
*
|
|
26
|
-
* @param {bigint} value - The bigint value to convert
|
|
27
|
-
* @param {Object} opts - Formatting options
|
|
28
|
-
* @param {number} [opts.decimals=18] - Number of decimals to use when converting from bigint
|
|
29
|
-
* @param {number} [opts.minimumFractionDigits=0] - Minimum number of fraction digits to display
|
|
30
|
-
* @param {number} [opts.maximumFractionDigits=3] - Maximum number of fraction digits to display
|
|
31
|
-
* @returns {string} The formatted number as a string
|
|
32
|
-
*
|
|
33
|
-
* @example
|
|
34
|
-
* // Returns "123.456"
|
|
35
|
-
* bigIntToNumberAsString(BigInt("123456000000000000000"), { decimals: 18 })
|
|
36
|
-
*/
|
|
37
|
-
declare function bigIntToNumberAsString(value: bigint, opts?: {
|
|
38
|
-
decimals?: number;
|
|
39
|
-
minimumFractionDigits?: number;
|
|
40
|
-
maximumFractionDigits?: number;
|
|
41
|
-
}): string;
|
|
42
|
-
/**
|
|
43
|
-
* Calculates the expected amount of shares to be minted based on deposit amount and rate
|
|
44
|
-
*
|
|
45
|
-
* The calculation follows the formula:
|
|
46
|
-
* sharesMinted = depositAmount * ONE_SHARE / rateInQuote
|
|
47
|
-
*
|
|
48
|
-
* @param {bigint} depositAmount - The amount to deposit in quote asset decimals
|
|
49
|
-
* @param {bigint} rateInQuote - The rate in quote representing "quote asset per share"
|
|
50
|
-
* @param {number} shareDecimals - The decimal precision of the BoringVault shares (ONE_SHARE)
|
|
51
|
-
* @returns {bigint} The expected amount of shares to be minted
|
|
52
|
-
*/
|
|
53
|
-
declare function calculateExpectedSharesMinted(depositAmount: bigint, rateInQuote: bigint, shareDecimals: number): bigint;
|
|
54
|
-
/**
|
|
55
|
-
* Calculates the atomic price with slippage applied
|
|
56
|
-
* The calculation follows the formula:
|
|
57
|
-
* atomicPrice = rateInQuote * (1 - slippage)
|
|
58
|
-
*
|
|
59
|
-
* @param {bigint} rateInQuote - The rate in quote representing "quote asset per share"
|
|
60
|
-
* @param {number} slippage - The maximum acceptable slippage as a decimal (e.g., 0.01 for 1%)
|
|
61
|
-
* @param {number} quoteDecimals - The decimal precision of the quote asset
|
|
62
|
-
* @returns {bigint} The atomic price with slippage applied
|
|
63
|
-
*/
|
|
64
|
-
declare function calculateAtomicPrice(rateInQuote: bigint, slippage: number): bigint;
|
|
65
|
-
|
|
66
|
-
/**
|
|
67
|
-
* Shared fetch utilities
|
|
68
|
-
*
|
|
69
|
-
* Common helpers for network requests across the SDK.
|
|
70
|
-
*/
|
|
71
|
-
/**
|
|
72
|
-
* Default timeout for network requests (10 seconds)
|
|
73
|
-
*/
|
|
74
|
-
declare const DEFAULT_TIMEOUT = 10000;
|
|
75
|
-
/**
|
|
76
|
-
* Creates an AbortSignal that times out after the specified duration
|
|
77
|
-
*/
|
|
78
|
-
declare function createTimeoutSignal(timeoutMs: number): AbortSignal;
|
|
79
|
-
|
|
80
|
-
/**
|
|
81
|
-
* @fileoverview Utility functions for time-related operations
|
|
82
|
-
*/
|
|
83
|
-
/**
|
|
84
|
-
* Calculates a deadline timestamp in seconds from the current time
|
|
85
|
-
*
|
|
86
|
-
* @param {number} [daysFromNow=DEFAULT_DEADLINE] - Number of days from now to set the deadline
|
|
87
|
-
* @returns {number} Unix timestamp in seconds representing the deadline
|
|
88
|
-
*
|
|
89
|
-
* @example
|
|
90
|
-
* // Returns a timestamp 3 days from now (in seconds)
|
|
91
|
-
* const threeDay = calculateDeadline();
|
|
92
|
-
*
|
|
93
|
-
* @example
|
|
94
|
-
* // Returns a timestamp 7 days from now (in seconds)
|
|
95
|
-
* const weekDeadline = calculateDeadline(7);
|
|
96
|
-
*/
|
|
97
|
-
declare const calculateDeadline: (daysFromNow?: number) => bigint;
|
|
98
|
-
|
|
99
|
-
type Success<T> = {
|
|
100
|
-
success: true;
|
|
101
|
-
data: T;
|
|
102
|
-
error?: never;
|
|
103
|
-
};
|
|
104
|
-
type Failure<E> = {
|
|
105
|
-
success: false;
|
|
106
|
-
data?: never;
|
|
107
|
-
error: E;
|
|
108
|
-
};
|
|
109
|
-
type SafeResult<T, E = Error> = Success<T> | Failure<E>;
|
|
110
|
-
declare function tryCatch<T, E = Error>(promise: Promise<T>): Promise<SafeResult<T, E>>;
|
|
111
|
-
|
|
112
|
-
export { DEFAULT_TIMEOUT, RAY, WAD, bigIntToNumberAsString, calculateAtomicPrice, calculateDeadline, calculateExpectedSharesMinted, createTimeoutSignal, tryCatch };
|
package/dist/utils.d.ts
DELETED
|
@@ -1,112 +0,0 @@
|
|
|
1
|
-
export { C as ChainId, c as clearChainsCache, g as getChainFromConfig, t as toChainId } from './chain-utils-BdJecHBA.js';
|
|
2
|
-
import 'viem/chains';
|
|
3
|
-
import 'viem';
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* RAY precision unit (10^27)
|
|
7
|
-
* Used for high precision fixed-point calculations
|
|
8
|
-
* @type {{bigint: bigint, number: number}}
|
|
9
|
-
*/
|
|
10
|
-
declare const RAY: {
|
|
11
|
-
bigint: bigint;
|
|
12
|
-
number: number;
|
|
13
|
-
};
|
|
14
|
-
/**
|
|
15
|
-
* WAD precision unit (10^18)
|
|
16
|
-
* Common precision unit for Ethereum tokens (matches ETH's 18 decimals)
|
|
17
|
-
* @type {{bigint: bigint, number: number}}
|
|
18
|
-
*/
|
|
19
|
-
declare const WAD: {
|
|
20
|
-
bigint: bigint;
|
|
21
|
-
number: number;
|
|
22
|
-
};
|
|
23
|
-
/**
|
|
24
|
-
* Converts a bigint value to a formatted number string with specified decimal precision
|
|
25
|
-
*
|
|
26
|
-
* @param {bigint} value - The bigint value to convert
|
|
27
|
-
* @param {Object} opts - Formatting options
|
|
28
|
-
* @param {number} [opts.decimals=18] - Number of decimals to use when converting from bigint
|
|
29
|
-
* @param {number} [opts.minimumFractionDigits=0] - Minimum number of fraction digits to display
|
|
30
|
-
* @param {number} [opts.maximumFractionDigits=3] - Maximum number of fraction digits to display
|
|
31
|
-
* @returns {string} The formatted number as a string
|
|
32
|
-
*
|
|
33
|
-
* @example
|
|
34
|
-
* // Returns "123.456"
|
|
35
|
-
* bigIntToNumberAsString(BigInt("123456000000000000000"), { decimals: 18 })
|
|
36
|
-
*/
|
|
37
|
-
declare function bigIntToNumberAsString(value: bigint, opts?: {
|
|
38
|
-
decimals?: number;
|
|
39
|
-
minimumFractionDigits?: number;
|
|
40
|
-
maximumFractionDigits?: number;
|
|
41
|
-
}): string;
|
|
42
|
-
/**
|
|
43
|
-
* Calculates the expected amount of shares to be minted based on deposit amount and rate
|
|
44
|
-
*
|
|
45
|
-
* The calculation follows the formula:
|
|
46
|
-
* sharesMinted = depositAmount * ONE_SHARE / rateInQuote
|
|
47
|
-
*
|
|
48
|
-
* @param {bigint} depositAmount - The amount to deposit in quote asset decimals
|
|
49
|
-
* @param {bigint} rateInQuote - The rate in quote representing "quote asset per share"
|
|
50
|
-
* @param {number} shareDecimals - The decimal precision of the BoringVault shares (ONE_SHARE)
|
|
51
|
-
* @returns {bigint} The expected amount of shares to be minted
|
|
52
|
-
*/
|
|
53
|
-
declare function calculateExpectedSharesMinted(depositAmount: bigint, rateInQuote: bigint, shareDecimals: number): bigint;
|
|
54
|
-
/**
|
|
55
|
-
* Calculates the atomic price with slippage applied
|
|
56
|
-
* The calculation follows the formula:
|
|
57
|
-
* atomicPrice = rateInQuote * (1 - slippage)
|
|
58
|
-
*
|
|
59
|
-
* @param {bigint} rateInQuote - The rate in quote representing "quote asset per share"
|
|
60
|
-
* @param {number} slippage - The maximum acceptable slippage as a decimal (e.g., 0.01 for 1%)
|
|
61
|
-
* @param {number} quoteDecimals - The decimal precision of the quote asset
|
|
62
|
-
* @returns {bigint} The atomic price with slippage applied
|
|
63
|
-
*/
|
|
64
|
-
declare function calculateAtomicPrice(rateInQuote: bigint, slippage: number): bigint;
|
|
65
|
-
|
|
66
|
-
/**
|
|
67
|
-
* Shared fetch utilities
|
|
68
|
-
*
|
|
69
|
-
* Common helpers for network requests across the SDK.
|
|
70
|
-
*/
|
|
71
|
-
/**
|
|
72
|
-
* Default timeout for network requests (10 seconds)
|
|
73
|
-
*/
|
|
74
|
-
declare const DEFAULT_TIMEOUT = 10000;
|
|
75
|
-
/**
|
|
76
|
-
* Creates an AbortSignal that times out after the specified duration
|
|
77
|
-
*/
|
|
78
|
-
declare function createTimeoutSignal(timeoutMs: number): AbortSignal;
|
|
79
|
-
|
|
80
|
-
/**
|
|
81
|
-
* @fileoverview Utility functions for time-related operations
|
|
82
|
-
*/
|
|
83
|
-
/**
|
|
84
|
-
* Calculates a deadline timestamp in seconds from the current time
|
|
85
|
-
*
|
|
86
|
-
* @param {number} [daysFromNow=DEFAULT_DEADLINE] - Number of days from now to set the deadline
|
|
87
|
-
* @returns {number} Unix timestamp in seconds representing the deadline
|
|
88
|
-
*
|
|
89
|
-
* @example
|
|
90
|
-
* // Returns a timestamp 3 days from now (in seconds)
|
|
91
|
-
* const threeDay = calculateDeadline();
|
|
92
|
-
*
|
|
93
|
-
* @example
|
|
94
|
-
* // Returns a timestamp 7 days from now (in seconds)
|
|
95
|
-
* const weekDeadline = calculateDeadline(7);
|
|
96
|
-
*/
|
|
97
|
-
declare const calculateDeadline: (daysFromNow?: number) => bigint;
|
|
98
|
-
|
|
99
|
-
type Success<T> = {
|
|
100
|
-
success: true;
|
|
101
|
-
data: T;
|
|
102
|
-
error?: never;
|
|
103
|
-
};
|
|
104
|
-
type Failure<E> = {
|
|
105
|
-
success: false;
|
|
106
|
-
data?: never;
|
|
107
|
-
error: E;
|
|
108
|
-
};
|
|
109
|
-
type SafeResult<T, E = Error> = Success<T> | Failure<E>;
|
|
110
|
-
declare function tryCatch<T, E = Error>(promise: Promise<T>): Promise<SafeResult<T, E>>;
|
|
111
|
-
|
|
112
|
-
export { DEFAULT_TIMEOUT, RAY, WAD, bigIntToNumberAsString, calculateAtomicPrice, calculateDeadline, calculateExpectedSharesMinted, createTimeoutSignal, tryCatch };
|
package/dist/utils.js
DELETED
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var chunkTNL23CO2_js = require('./chunk-TNL23CO2.js');
|
|
4
|
-
var chunkWYBYBPX5_js = require('./chunk-WYBYBPX5.js');
|
|
5
|
-
|
|
6
|
-
// src/utils/time.ts
|
|
7
|
-
var calculateDeadline = (daysFromNow = chunkWYBYBPX5_js.DEFAULT_DEADLINE) => {
|
|
8
|
-
const daysInSeconds = daysFromNow * 24 * 60 * 60;
|
|
9
|
-
const currentTimeStamp = Math.floor(Date.now() / 1e3);
|
|
10
|
-
const deadline = currentTimeStamp + daysInSeconds;
|
|
11
|
-
return BigInt(deadline);
|
|
12
|
-
};
|
|
13
|
-
|
|
14
|
-
// src/utils/try-catch.ts
|
|
15
|
-
async function tryCatch(promise) {
|
|
16
|
-
try {
|
|
17
|
-
const data = await promise;
|
|
18
|
-
return { data, error: void 0, success: true };
|
|
19
|
-
} catch (error) {
|
|
20
|
-
return { data: void 0, error, success: false };
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
Object.defineProperty(exports, "RAY", {
|
|
25
|
-
enumerable: true,
|
|
26
|
-
get: function () { return chunkTNL23CO2_js.RAY; }
|
|
27
|
-
});
|
|
28
|
-
Object.defineProperty(exports, "WAD", {
|
|
29
|
-
enumerable: true,
|
|
30
|
-
get: function () { return chunkTNL23CO2_js.WAD; }
|
|
31
|
-
});
|
|
32
|
-
Object.defineProperty(exports, "bigIntToNumberAsString", {
|
|
33
|
-
enumerable: true,
|
|
34
|
-
get: function () { return chunkTNL23CO2_js.bigIntToNumberAsString; }
|
|
35
|
-
});
|
|
36
|
-
Object.defineProperty(exports, "calculateAtomicPrice", {
|
|
37
|
-
enumerable: true,
|
|
38
|
-
get: function () { return chunkTNL23CO2_js.calculateAtomicPrice; }
|
|
39
|
-
});
|
|
40
|
-
Object.defineProperty(exports, "calculateExpectedSharesMinted", {
|
|
41
|
-
enumerable: true,
|
|
42
|
-
get: function () { return chunkTNL23CO2_js.calculateExpectedSharesMinted; }
|
|
43
|
-
});
|
|
44
|
-
Object.defineProperty(exports, "DEFAULT_TIMEOUT", {
|
|
45
|
-
enumerable: true,
|
|
46
|
-
get: function () { return chunkWYBYBPX5_js.DEFAULT_TIMEOUT; }
|
|
47
|
-
});
|
|
48
|
-
Object.defineProperty(exports, "clearChainsCache", {
|
|
49
|
-
enumerable: true,
|
|
50
|
-
get: function () { return chunkWYBYBPX5_js.clearChainsCache; }
|
|
51
|
-
});
|
|
52
|
-
Object.defineProperty(exports, "createTimeoutSignal", {
|
|
53
|
-
enumerable: true,
|
|
54
|
-
get: function () { return chunkWYBYBPX5_js.createTimeoutSignal; }
|
|
55
|
-
});
|
|
56
|
-
Object.defineProperty(exports, "getChainFromConfig", {
|
|
57
|
-
enumerable: true,
|
|
58
|
-
get: function () { return chunkWYBYBPX5_js.getChainFromConfig; }
|
|
59
|
-
});
|
|
60
|
-
Object.defineProperty(exports, "toChainId", {
|
|
61
|
-
enumerable: true,
|
|
62
|
-
get: function () { return chunkWYBYBPX5_js.toChainId; }
|
|
63
|
-
});
|
|
64
|
-
exports.calculateDeadline = calculateDeadline;
|
|
65
|
-
exports.tryCatch = tryCatch;
|
|
66
|
-
//# sourceMappingURL=utils.js.map
|
|
67
|
-
//# sourceMappingURL=utils.js.map
|
package/dist/utils.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/utils/time.ts","../src/utils/try-catch.ts"],"names":["DEFAULT_DEADLINE"],"mappings":";;;;;;AAoBO,IAAM,iBAAA,GAAoB,CAAC,WAAA,GAAcA,iCAAA,KAAqB;AAEnE,EAAA,MAAM,aAAA,GAAgB,WAAA,GAAc,EAAA,GAAK,EAAA,GAAK,EAAA;AAG9C,EAAA,MAAM,mBAAmB,IAAA,CAAK,KAAA,CAAM,IAAA,CAAK,GAAA,KAAQ,GAAI,CAAA;AAGrD,EAAA,MAAM,WAAW,gBAAA,GAAmB,aAAA;AAEpC,EAAA,OAAO,OAAO,QAAQ,CAAA;AACxB;;;ACjBA,eAAsB,SACpB,OAAA,EAC2B;AAC3B,EAAA,IAAI;AACF,IAAA,MAAM,OAAO,MAAM,OAAA;AACnB,IAAA,OAAO,EAAE,IAAA,EAAM,KAAA,EAAO,KAAA,CAAA,EAAW,SAAS,IAAA,EAAK;AAAA,EACjD,SAAS,KAAA,EAAO;AACd,IAAA,OAAO,EAAE,IAAA,EAAM,MAAA,EAAW,KAAA,EAAmB,SAAS,KAAA,EAAM;AAAA,EAC9D;AACF","file":"utils.js","sourcesContent":["/**\n * @fileoverview Utility functions for time-related operations\n */\n\nimport { DEFAULT_DEADLINE } from '../constants'\n\n/**\n * Calculates a deadline timestamp in seconds from the current time\n *\n * @param {number} [daysFromNow=DEFAULT_DEADLINE] - Number of days from now to set the deadline\n * @returns {number} Unix timestamp in seconds representing the deadline\n *\n * @example\n * // Returns a timestamp 3 days from now (in seconds)\n * const threeDay = calculateDeadline();\n *\n * @example\n * // Returns a timestamp 7 days from now (in seconds)\n * const weekDeadline = calculateDeadline(7);\n */\nexport const calculateDeadline = (daysFromNow = DEFAULT_DEADLINE) => {\n // Get days in seconds\n const daysInSeconds = daysFromNow * 24 * 60 * 60\n\n // Get current timestamp in seconds\n const currentTimeStamp = Math.floor(Date.now() / 1000)\n\n // Calculate deadline (current time + 3 days in seconds)\n const deadline = currentTimeStamp + daysInSeconds\n\n return BigInt(deadline)\n}\n","type Success<T> = {\n success: true\n data: T\n error?: never\n}\n\ntype Failure<E> = {\n success: false\n data?: never\n error: E\n}\n\ntype SafeResult<T, E = Error> = Success<T> | Failure<E>\n\nexport async function tryCatch<T, E = Error>(\n promise: Promise<T>\n): Promise<SafeResult<T, E>> {\n try {\n const data = await promise\n return { data, error: undefined, success: true }\n } catch (error) {\n return { data: undefined, error: error as E, success: false }\n }\n}\n"]}
|
package/dist/utils.mjs
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
export { RAY, WAD, bigIntToNumberAsString, calculateAtomicPrice, calculateExpectedSharesMinted } from './chunk-6CU533DM.mjs';
|
|
2
|
-
import { DEFAULT_DEADLINE } from './chunk-WK7EJRBB.mjs';
|
|
3
|
-
export { DEFAULT_TIMEOUT, clearChainsCache, createTimeoutSignal, getChainFromConfig, toChainId } from './chunk-WK7EJRBB.mjs';
|
|
4
|
-
|
|
5
|
-
// src/utils/time.ts
|
|
6
|
-
var calculateDeadline = (daysFromNow = DEFAULT_DEADLINE) => {
|
|
7
|
-
const daysInSeconds = daysFromNow * 24 * 60 * 60;
|
|
8
|
-
const currentTimeStamp = Math.floor(Date.now() / 1e3);
|
|
9
|
-
const deadline = currentTimeStamp + daysInSeconds;
|
|
10
|
-
return BigInt(deadline);
|
|
11
|
-
};
|
|
12
|
-
|
|
13
|
-
// src/utils/try-catch.ts
|
|
14
|
-
async function tryCatch(promise) {
|
|
15
|
-
try {
|
|
16
|
-
const data = await promise;
|
|
17
|
-
return { data, error: void 0, success: true };
|
|
18
|
-
} catch (error) {
|
|
19
|
-
return { data: void 0, error, success: false };
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
export { calculateDeadline, tryCatch };
|
|
24
|
-
//# sourceMappingURL=utils.mjs.map
|
|
25
|
-
//# sourceMappingURL=utils.mjs.map
|
package/dist/utils.mjs.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/utils/time.ts","../src/utils/try-catch.ts"],"names":[],"mappings":";;;;;AAoBO,IAAM,iBAAA,GAAoB,CAAC,WAAA,GAAc,gBAAA,KAAqB;AAEnE,EAAA,MAAM,aAAA,GAAgB,WAAA,GAAc,EAAA,GAAK,EAAA,GAAK,EAAA;AAG9C,EAAA,MAAM,mBAAmB,IAAA,CAAK,KAAA,CAAM,IAAA,CAAK,GAAA,KAAQ,GAAI,CAAA;AAGrD,EAAA,MAAM,WAAW,gBAAA,GAAmB,aAAA;AAEpC,EAAA,OAAO,OAAO,QAAQ,CAAA;AACxB;;;ACjBA,eAAsB,SACpB,OAAA,EAC2B;AAC3B,EAAA,IAAI;AACF,IAAA,MAAM,OAAO,MAAM,OAAA;AACnB,IAAA,OAAO,EAAE,IAAA,EAAM,KAAA,EAAO,KAAA,CAAA,EAAW,SAAS,IAAA,EAAK;AAAA,EACjD,SAAS,KAAA,EAAO;AACd,IAAA,OAAO,EAAE,IAAA,EAAM,MAAA,EAAW,KAAA,EAAmB,SAAS,KAAA,EAAM;AAAA,EAC9D;AACF","file":"utils.mjs","sourcesContent":["/**\n * @fileoverview Utility functions for time-related operations\n */\n\nimport { DEFAULT_DEADLINE } from '../constants'\n\n/**\n * Calculates a deadline timestamp in seconds from the current time\n *\n * @param {number} [daysFromNow=DEFAULT_DEADLINE] - Number of days from now to set the deadline\n * @returns {number} Unix timestamp in seconds representing the deadline\n *\n * @example\n * // Returns a timestamp 3 days from now (in seconds)\n * const threeDay = calculateDeadline();\n *\n * @example\n * // Returns a timestamp 7 days from now (in seconds)\n * const weekDeadline = calculateDeadline(7);\n */\nexport const calculateDeadline = (daysFromNow = DEFAULT_DEADLINE) => {\n // Get days in seconds\n const daysInSeconds = daysFromNow * 24 * 60 * 60\n\n // Get current timestamp in seconds\n const currentTimeStamp = Math.floor(Date.now() / 1000)\n\n // Calculate deadline (current time + 3 days in seconds)\n const deadline = currentTimeStamp + daysInSeconds\n\n return BigInt(deadline)\n}\n","type Success<T> = {\n success: true\n data: T\n error?: never\n}\n\ntype Failure<E> = {\n success: false\n data?: never\n error: E\n}\n\ntype SafeResult<T, E = Error> = Success<T> | Failure<E>\n\nexport async function tryCatch<T, E = Error>(\n promise: Promise<T>\n): Promise<SafeResult<T, E>> {\n try {\n const data = await promise\n return { data, error: undefined, success: true }\n } catch (error) {\n return { data: undefined, error: error as E, success: false }\n }\n}\n"]}
|
package/dist/vaults.d.mts
DELETED
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
export { A as AlreadyApprovedAuthorizationResult, a as ApprovalAuthorizationResult, b as ApproveDepositTokenTxData, c as ApproveWithdrawOrderTxData, C as CancelWithdrawOrderTxData, D as DepositAuthMethod, e as DepositAuthorizationResult, f as DepositTxData, E as EIP712Domain, P as PERMIT_TYPES, j as ParsedPermitSignature, k as PermitAuthorizationResult, l as PermitDepositResult, m as PermitSignatureData, a4 as PrepareApproveDepositTokenTxParams, a5 as PrepareApproveWithdrawOrderTxDataParams, n as PrepareCancelWithdrawOrderTxDataParams, o as PrepareDepositAuthorizationParams, p as PrepareDepositParams, q as PrepareDepositPermitSignatureParams, r as PrepareDepositResult, a6 as PrepareDepositTxDataParams, s as PrepareDepositWithPermitTxDataParams, t as PrepareWithdrawOrderTxDataParams, u as PrepareWithdrawalAuthorizationParams, v as PrepareWithdrawalParams, w as PrepareWithdrawalResult, S as StandardDepositResult, U as UnencodedDepositWithPermitData, W as WithdrawAlreadyApprovedAuthorizationResult, z as WithdrawApprovalAuthorizationResult, B as WithdrawAuthMethod, F as WithdrawAuthorizationResult, G as WithdrawOrderTxData, H as isAlreadyApprovedAuth, I as isApprovalAuth, L as isPermitAuth, N as isWithdrawAlreadyApprovedAuth, O as isWithdrawApprovalAuth, Q as parsePermitSignature, R as prepareApproveDepositTokenTxData, T as prepareApproveWithdrawOrderTxData, V as prepareCancelWithdrawOrderTxData, X as prepareDeposit, Y as prepareDepositAuthorization, Z as prepareDepositPermitSignature, _ as prepareDepositTxData, $ as prepareDepositWithPermitTxData, a0 as prepareWithdrawOrderTxData, a1 as prepareWithdrawal, a2 as prepareWithdrawalAuthorization, a3 as toEthSignTypedDataV4 } from './index-DXXA8gEA.mjs';
|
|
2
|
-
import 'viem';
|
|
3
|
-
import './chain-utils-BdJecHBA.mjs';
|
|
4
|
-
import 'viem/chains';
|
package/dist/vaults.d.ts
DELETED
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
export { A as AlreadyApprovedAuthorizationResult, a as ApprovalAuthorizationResult, b as ApproveDepositTokenTxData, c as ApproveWithdrawOrderTxData, C as CancelWithdrawOrderTxData, D as DepositAuthMethod, e as DepositAuthorizationResult, f as DepositTxData, E as EIP712Domain, P as PERMIT_TYPES, j as ParsedPermitSignature, k as PermitAuthorizationResult, l as PermitDepositResult, m as PermitSignatureData, a4 as PrepareApproveDepositTokenTxParams, a5 as PrepareApproveWithdrawOrderTxDataParams, n as PrepareCancelWithdrawOrderTxDataParams, o as PrepareDepositAuthorizationParams, p as PrepareDepositParams, q as PrepareDepositPermitSignatureParams, r as PrepareDepositResult, a6 as PrepareDepositTxDataParams, s as PrepareDepositWithPermitTxDataParams, t as PrepareWithdrawOrderTxDataParams, u as PrepareWithdrawalAuthorizationParams, v as PrepareWithdrawalParams, w as PrepareWithdrawalResult, S as StandardDepositResult, U as UnencodedDepositWithPermitData, W as WithdrawAlreadyApprovedAuthorizationResult, z as WithdrawApprovalAuthorizationResult, B as WithdrawAuthMethod, F as WithdrawAuthorizationResult, G as WithdrawOrderTxData, H as isAlreadyApprovedAuth, I as isApprovalAuth, L as isPermitAuth, N as isWithdrawAlreadyApprovedAuth, O as isWithdrawApprovalAuth, Q as parsePermitSignature, R as prepareApproveDepositTokenTxData, T as prepareApproveWithdrawOrderTxData, V as prepareCancelWithdrawOrderTxData, X as prepareDeposit, Y as prepareDepositAuthorization, Z as prepareDepositPermitSignature, _ as prepareDepositTxData, $ as prepareDepositWithPermitTxData, a0 as prepareWithdrawOrderTxData, a1 as prepareWithdrawal, a2 as prepareWithdrawalAuthorization, a3 as toEthSignTypedDataV4 } from './index-aE5lTOUH.js';
|
|
2
|
-
import 'viem';
|
|
3
|
-
import './chain-utils-BdJecHBA.js';
|
|
4
|
-
import 'viem/chains';
|
package/dist/vaults.js
DELETED
|
@@ -1,96 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var chunk5OK753GA_js = require('./chunk-5OK753GA.js');
|
|
4
|
-
require('./chunk-ZKDXRGI5.js');
|
|
5
|
-
require('./chunk-NNDY5TID.js');
|
|
6
|
-
require('./chunk-TNL23CO2.js');
|
|
7
|
-
require('./chunk-WYBYBPX5.js');
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
Object.defineProperty(exports, "DepositAuthMethod", {
|
|
12
|
-
enumerable: true,
|
|
13
|
-
get: function () { return chunk5OK753GA_js.DepositAuthMethod; }
|
|
14
|
-
});
|
|
15
|
-
Object.defineProperty(exports, "PERMIT_TYPES", {
|
|
16
|
-
enumerable: true,
|
|
17
|
-
get: function () { return chunk5OK753GA_js.PERMIT_TYPES; }
|
|
18
|
-
});
|
|
19
|
-
Object.defineProperty(exports, "WithdrawAuthMethod", {
|
|
20
|
-
enumerable: true,
|
|
21
|
-
get: function () { return chunk5OK753GA_js.WithdrawAuthMethod; }
|
|
22
|
-
});
|
|
23
|
-
Object.defineProperty(exports, "isAlreadyApprovedAuth", {
|
|
24
|
-
enumerable: true,
|
|
25
|
-
get: function () { return chunk5OK753GA_js.isAlreadyApprovedAuth; }
|
|
26
|
-
});
|
|
27
|
-
Object.defineProperty(exports, "isApprovalAuth", {
|
|
28
|
-
enumerable: true,
|
|
29
|
-
get: function () { return chunk5OK753GA_js.isApprovalAuth; }
|
|
30
|
-
});
|
|
31
|
-
Object.defineProperty(exports, "isPermitAuth", {
|
|
32
|
-
enumerable: true,
|
|
33
|
-
get: function () { return chunk5OK753GA_js.isPermitAuth; }
|
|
34
|
-
});
|
|
35
|
-
Object.defineProperty(exports, "isWithdrawAlreadyApprovedAuth", {
|
|
36
|
-
enumerable: true,
|
|
37
|
-
get: function () { return chunk5OK753GA_js.isWithdrawAlreadyApprovedAuth; }
|
|
38
|
-
});
|
|
39
|
-
Object.defineProperty(exports, "isWithdrawApprovalAuth", {
|
|
40
|
-
enumerable: true,
|
|
41
|
-
get: function () { return chunk5OK753GA_js.isWithdrawApprovalAuth; }
|
|
42
|
-
});
|
|
43
|
-
Object.defineProperty(exports, "parsePermitSignature", {
|
|
44
|
-
enumerable: true,
|
|
45
|
-
get: function () { return chunk5OK753GA_js.parsePermitSignature; }
|
|
46
|
-
});
|
|
47
|
-
Object.defineProperty(exports, "prepareApproveDepositTokenTxData", {
|
|
48
|
-
enumerable: true,
|
|
49
|
-
get: function () { return chunk5OK753GA_js.prepareApproveDepositTokenTxData; }
|
|
50
|
-
});
|
|
51
|
-
Object.defineProperty(exports, "prepareApproveWithdrawOrderTxData", {
|
|
52
|
-
enumerable: true,
|
|
53
|
-
get: function () { return chunk5OK753GA_js.prepareApproveWithdrawOrderTxData; }
|
|
54
|
-
});
|
|
55
|
-
Object.defineProperty(exports, "prepareCancelWithdrawOrderTxData", {
|
|
56
|
-
enumerable: true,
|
|
57
|
-
get: function () { return chunk5OK753GA_js.prepareCancelWithdrawOrderTxData; }
|
|
58
|
-
});
|
|
59
|
-
Object.defineProperty(exports, "prepareDeposit", {
|
|
60
|
-
enumerable: true,
|
|
61
|
-
get: function () { return chunk5OK753GA_js.prepareDeposit; }
|
|
62
|
-
});
|
|
63
|
-
Object.defineProperty(exports, "prepareDepositAuthorization", {
|
|
64
|
-
enumerable: true,
|
|
65
|
-
get: function () { return chunk5OK753GA_js.prepareDepositAuthorization; }
|
|
66
|
-
});
|
|
67
|
-
Object.defineProperty(exports, "prepareDepositPermitSignature", {
|
|
68
|
-
enumerable: true,
|
|
69
|
-
get: function () { return chunk5OK753GA_js.prepareDepositPermitSignature; }
|
|
70
|
-
});
|
|
71
|
-
Object.defineProperty(exports, "prepareDepositTxData", {
|
|
72
|
-
enumerable: true,
|
|
73
|
-
get: function () { return chunk5OK753GA_js.prepareDepositTxData; }
|
|
74
|
-
});
|
|
75
|
-
Object.defineProperty(exports, "prepareDepositWithPermitTxData", {
|
|
76
|
-
enumerable: true,
|
|
77
|
-
get: function () { return chunk5OK753GA_js.prepareDepositWithPermitTxData; }
|
|
78
|
-
});
|
|
79
|
-
Object.defineProperty(exports, "prepareWithdrawOrderTxData", {
|
|
80
|
-
enumerable: true,
|
|
81
|
-
get: function () { return chunk5OK753GA_js.prepareWithdrawOrderTxData; }
|
|
82
|
-
});
|
|
83
|
-
Object.defineProperty(exports, "prepareWithdrawal", {
|
|
84
|
-
enumerable: true,
|
|
85
|
-
get: function () { return chunk5OK753GA_js.prepareWithdrawal; }
|
|
86
|
-
});
|
|
87
|
-
Object.defineProperty(exports, "prepareWithdrawalAuthorization", {
|
|
88
|
-
enumerable: true,
|
|
89
|
-
get: function () { return chunk5OK753GA_js.prepareWithdrawalAuthorization; }
|
|
90
|
-
});
|
|
91
|
-
Object.defineProperty(exports, "toEthSignTypedDataV4", {
|
|
92
|
-
enumerable: true,
|
|
93
|
-
get: function () { return chunk5OK753GA_js.toEthSignTypedDataV4; }
|
|
94
|
-
});
|
|
95
|
-
//# sourceMappingURL=vaults.js.map
|
|
96
|
-
//# sourceMappingURL=vaults.js.map
|
package/dist/vaults.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":[],"names":[],"mappings":"","file":"vaults.js"}
|
package/dist/vaults.mjs
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
export { DepositAuthMethod, PERMIT_TYPES, WithdrawAuthMethod, isAlreadyApprovedAuth, isApprovalAuth, isPermitAuth, isWithdrawAlreadyApprovedAuth, isWithdrawApprovalAuth, parsePermitSignature, prepareApproveDepositTokenTxData, prepareApproveWithdrawOrderTxData, prepareCancelWithdrawOrderTxData, prepareDeposit, prepareDepositAuthorization, prepareDepositPermitSignature, prepareDepositTxData, prepareDepositWithPermitTxData, prepareWithdrawOrderTxData, prepareWithdrawal, prepareWithdrawalAuthorization, toEthSignTypedDataV4 } from './chunk-HU5CTL4C.mjs';
|
|
2
|
-
import './chunk-7JQQ2TH4.mjs';
|
|
3
|
-
import './chunk-Q5FXJU5Y.mjs';
|
|
4
|
-
import './chunk-6CU533DM.mjs';
|
|
5
|
-
import './chunk-WK7EJRBB.mjs';
|
|
6
|
-
//# sourceMappingURL=vaults.mjs.map
|
|
7
|
-
//# sourceMappingURL=vaults.mjs.map
|
package/dist/vaults.mjs.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":[],"names":[],"mappings":"","file":"vaults.mjs"}
|