lampamazaza-new-intents-sdk 0.47.1 → 0.47.2
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.cjs +12 -12
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/src/bridges/aurora-engine-bridge/aurora-engine-bridge-utils.cjs +5 -5
- package/dist/src/bridges/aurora-engine-bridge/aurora-engine-bridge-utils.js +1 -1
- package/dist/src/bridges/aurora-engine-bridge/aurora-engine-bridge.cjs +5 -5
- package/dist/src/bridges/aurora-engine-bridge/aurora-engine-bridge.js +1 -1
- package/dist/src/bridges/direct-bridge/direct-bridge-utils.cjs +5 -5
- package/dist/src/bridges/direct-bridge/direct-bridge-utils.js +1 -1
- package/dist/src/bridges/direct-bridge/direct-bridge.cjs +6 -6
- package/dist/src/bridges/direct-bridge/direct-bridge.js +1 -1
- package/dist/src/bridges/direct-bridge/error.cjs +2 -2
- package/dist/src/bridges/direct-bridge/error.d.cts +1 -1
- package/dist/src/bridges/direct-bridge/error.d.ts +1 -1
- package/dist/src/bridges/direct-bridge/error.js +1 -1
- package/dist/src/bridges/hot-bridge/error.cjs +3 -3
- package/dist/src/bridges/hot-bridge/error.d.cts +1 -1
- package/dist/src/bridges/hot-bridge/error.d.ts +1 -1
- package/dist/src/bridges/hot-bridge/error.js +1 -1
- package/dist/src/bridges/hot-bridge/hot-bridge-utils.cjs +2 -2
- package/dist/src/bridges/hot-bridge/hot-bridge-utils.js +1 -1
- package/dist/src/bridges/hot-bridge/hot-bridge.cjs +10 -10
- package/dist/src/bridges/hot-bridge/hot-bridge.js +1 -1
- package/dist/src/bridges/omni-bridge/error.cjs +6 -6
- package/dist/src/bridges/omni-bridge/error.d.cts +1 -1
- package/dist/src/bridges/omni-bridge/error.d.ts +1 -1
- package/dist/src/bridges/omni-bridge/error.js +1 -1
- package/dist/src/bridges/omni-bridge/omni-bridge-utils.cjs +7 -7
- package/dist/src/bridges/omni-bridge/omni-bridge-utils.js +1 -1
- package/dist/src/bridges/omni-bridge/omni-bridge.cjs +23 -23
- package/dist/src/bridges/omni-bridge/omni-bridge.js +1 -1
- package/dist/src/bridges/poa-bridge/poa-bridge-utils.cjs +2 -2
- package/dist/src/bridges/poa-bridge/poa-bridge-utils.js +1 -1
- package/dist/src/bridges/poa-bridge/poa-bridge.cjs +11 -11
- package/dist/src/bridges/poa-bridge/poa-bridge.js +1 -1
- package/dist/src/classes/errors.cjs +7 -7
- package/dist/src/classes/errors.d.cts +1 -1
- package/dist/src/classes/errors.d.ts +1 -1
- package/dist/src/classes/errors.js +1 -1
- package/dist/src/core/withdrawal-watcher.cjs +8 -8
- package/dist/src/core/withdrawal-watcher.d.cts +1 -1
- package/dist/src/core/withdrawal-watcher.d.ts +1 -1
- package/dist/src/core/withdrawal-watcher.js +1 -1
- package/dist/src/intents/intent-executer-impl/intent-executer.d.cts +1 -1
- package/dist/src/intents/intent-executer-impl/intent-executer.d.ts +1 -1
- package/dist/src/intents/intent-hash.d.cts +1 -1
- package/dist/src/intents/intent-hash.d.ts +1 -1
- package/dist/src/intents/intent-hashes/sep53.cjs +2 -2
- package/dist/src/intents/intent-hashes/sep53.js +1 -1
- package/dist/src/intents/intent-payload-builder.cjs +2 -2
- package/dist/src/intents/intent-payload-builder.d.cts +1 -1
- package/dist/src/intents/intent-payload-builder.d.ts +1 -1
- package/dist/src/intents/intent-payload-builder.js +1 -1
- package/dist/src/intents/intent-relayer-impl/intent-relayer-public.cjs +3 -3
- package/dist/src/intents/intent-relayer-impl/intent-relayer-public.js +1 -1
- package/dist/src/intents/intent-signer-impl/intent-signer-viem.cjs +3 -3
- package/dist/src/intents/intent-signer-impl/intent-signer-viem.js +1 -1
- package/dist/src/intents/interfaces/intent-relayer.d.cts +1 -1
- package/dist/src/intents/interfaces/intent-relayer.d.ts +1 -1
- package/dist/src/intents/salt-manager.cjs +2 -2
- package/dist/src/intents/salt-manager.js +1 -1
- package/dist/src/intents/shared-types.d.cts +1 -1
- package/dist/src/intents/shared-types.d.ts +1 -1
- package/dist/src/lib/array.cjs +2 -2
- package/dist/src/lib/array.js +1 -1
- package/dist/src/lib/caip2.cjs +4 -4
- package/dist/src/lib/caip2.js +1 -1
- package/dist/src/lib/configure-rpc-config.cjs +3 -3
- package/dist/src/lib/configure-rpc-config.js +1 -1
- package/dist/src/lib/estimate-fee.cjs +4 -4
- package/dist/src/lib/estimate-fee.js +1 -1
- package/dist/src/lib/parse-defuse-asset-id.cjs +2 -2
- package/dist/src/lib/parse-defuse-asset-id.js +1 -1
- package/dist/src/lib/tokensUsdPricesHttpClient/apis.cjs +2 -2
- package/dist/src/lib/tokensUsdPricesHttpClient/apis.js +1 -1
- package/dist/src/lib/validateAddress.cjs +2 -2
- package/dist/src/lib/validateAddress.js +1 -1
- package/dist/src/sdk.cjs +11 -11
- package/dist/src/sdk.d.cts +1 -1
- package/dist/src/sdk.d.ts +1 -1
- package/dist/src/sdk.js +1 -1
- package/dist/src/shared-types.d.cts +1 -1
- package/dist/src/shared-types.d.ts +1 -1
- package/package.json +3 -3
|
@@ -2,7 +2,7 @@ const require_rolldown_runtime = require('../../../_virtual/rolldown_runtime.cjs
|
|
|
2
2
|
const require_caip2 = require('../../lib/caip2.cjs');
|
|
3
3
|
const require_omni_bridge_constants = require('./omni-bridge-constants.cjs');
|
|
4
4
|
const require_poa_tokens_routable_through_omni_bridge = require('../../constants/poa-tokens-routable-through-omni-bridge.cjs');
|
|
5
|
-
let
|
|
5
|
+
let lampamazaza_new_internal_utils = require("lampamazaza-new-internal-utils");
|
|
6
6
|
let valibot = require("valibot");
|
|
7
7
|
valibot = require_rolldown_runtime.__toESM(valibot);
|
|
8
8
|
let _omni_bridge_core = require("@omni-bridge/core");
|
|
@@ -10,8 +10,8 @@ let _omni_bridge_near = require("@omni-bridge/near");
|
|
|
10
10
|
|
|
11
11
|
//#region src/bridges/omni-bridge/omni-bridge-utils.ts
|
|
12
12
|
function createWithdrawIntentsPrimitive(params) {
|
|
13
|
-
const { contractId: tokenAccountId, standard } =
|
|
14
|
-
(0,
|
|
13
|
+
const { contractId: tokenAccountId, standard } = lampamazaza_new_internal_utils.utils.parseDefuseAssetId(params.assetId);
|
|
14
|
+
(0, lampamazaza_new_internal_utils.assert)(standard === "nep141", "Only NEP-141 is supported");
|
|
15
15
|
const recipient = (0, _omni_bridge_core.omniAddress)(params.omniChainKind, params.destinationAddress);
|
|
16
16
|
let msg = "";
|
|
17
17
|
const ftWithdrawPayload = {
|
|
@@ -20,7 +20,7 @@ function createWithdrawIntentsPrimitive(params) {
|
|
|
20
20
|
native_token_fee: params.nativeFee.toString()
|
|
21
21
|
};
|
|
22
22
|
if (isUtxoChain(params.omniChainKind)) {
|
|
23
|
-
(0,
|
|
23
|
+
(0, lampamazaza_new_internal_utils.assert)(params.utxoMaxGasFee !== null && params.utxoMaxGasFee > 0n, `Invalid utxo max gas fee: expected > 0, got ${params.utxoMaxGasFee}`);
|
|
24
24
|
msg = JSON.stringify({ MaxGasFee: params.utxoMaxGasFee.toString() });
|
|
25
25
|
ftWithdrawPayload.msg = msg;
|
|
26
26
|
}
|
|
@@ -82,7 +82,7 @@ function validateOmniToken(nearAddress) {
|
|
|
82
82
|
return (0, _omni_bridge_core.isBridgeToken)(nearAddress);
|
|
83
83
|
}
|
|
84
84
|
async function getAccountOmniStorageBalance(nearProvider, accountId) {
|
|
85
|
-
return
|
|
85
|
+
return lampamazaza_new_internal_utils.utils.queryContract({
|
|
86
86
|
contractId: require_omni_bridge_constants.OMNI_BRIDGE_CONTRACT,
|
|
87
87
|
methodName: "storage_balance_of",
|
|
88
88
|
args: { account_id: accountId },
|
|
@@ -108,7 +108,7 @@ const OmniAddressSchema = valibot.custom((input) => typeof input === "string" &&
|
|
|
108
108
|
* const ethAddress = await getBridgedToken("near:token123", ChainKind.Ethereum)
|
|
109
109
|
*/
|
|
110
110
|
async function getBridgedToken(nearProvider, tokenAddress, destinationChain) {
|
|
111
|
-
return
|
|
111
|
+
return lampamazaza_new_internal_utils.utils.queryContract({
|
|
112
112
|
contractId: require_omni_bridge_constants.OMNI_BRIDGE_CONTRACT,
|
|
113
113
|
methodName: "get_bridged_token",
|
|
114
114
|
args: {
|
|
@@ -128,7 +128,7 @@ async function getBridgedToken(nearProvider, tokenAddress, destinationChain) {
|
|
|
128
128
|
*/
|
|
129
129
|
async function getTokenDecimals(nearProvider, tokenAddress) {
|
|
130
130
|
if ((0, _omni_bridge_core.getChain)(tokenAddress) === _omni_bridge_core.ChainKind.Near) throw new Error("Token decimals cannot be queried using NEAR addresses. Use the token's foreign chain representation (e.g., eth:0x...) to query decimals.");
|
|
131
|
-
return
|
|
131
|
+
return lampamazaza_new_internal_utils.utils.queryContract({
|
|
132
132
|
contractId: require_omni_bridge_constants.OMNI_BRIDGE_CONTRACT,
|
|
133
133
|
methodName: "get_token_decimals",
|
|
134
134
|
args: { address: tokenAddress },
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Chains } from "../../lib/caip2.js";
|
|
2
2
|
import { MIN_GAS_AMOUNT, OMNI_BRIDGE_CONTRACT } from "./omni-bridge-constants.js";
|
|
3
3
|
import { POA_TOKENS_ROUTABLE_THROUGH_OMNI_BRIDGE } from "../../constants/poa-tokens-routable-through-omni-bridge.js";
|
|
4
|
-
import { assert, utils } from "lampamazaza-internal-utils";
|
|
4
|
+
import { assert, utils } from "lampamazaza-new-internal-utils";
|
|
5
5
|
import * as v from "valibot";
|
|
6
6
|
import { ChainKind, getChain, isBridgeToken, omniAddress } from "@omni-bridge/core";
|
|
7
7
|
import { calculateStorageAccountId } from "@omni-bridge/near";
|
|
@@ -9,7 +9,7 @@ const require_error = require('./error.cjs');
|
|
|
9
9
|
const require_omni_bridge_constants = require('./omni-bridge-constants.cjs');
|
|
10
10
|
const require_poa_tokens_routable_through_omni_bridge = require('../../constants/poa-tokens-routable-through-omni-bridge.cjs');
|
|
11
11
|
const require_omni_bridge_utils = require('./omni-bridge-utils.cjs');
|
|
12
|
-
let
|
|
12
|
+
let lampamazaza_new_internal_utils = require("lampamazaza-new-internal-utils");
|
|
13
13
|
let lru_cache = require("lru-cache");
|
|
14
14
|
let _isaacs_ttlcache = require("@isaacs/ttlcache");
|
|
15
15
|
_isaacs_ttlcache = require_rolldown_runtime.__toESM(_isaacs_ttlcache);
|
|
@@ -99,9 +99,9 @@ var OmniBridge = class {
|
|
|
99
99
|
}
|
|
100
100
|
async createWithdrawalIntents(args) {
|
|
101
101
|
const assetInfo = this.makeAssetInfo(args.withdrawalParams.assetId, args.withdrawalParams.routeConfig);
|
|
102
|
-
(0,
|
|
102
|
+
(0, lampamazaza_new_internal_utils.assert)(assetInfo !== null, `Asset ${args.withdrawalParams.assetId} is not supported by Omni Bridge`);
|
|
103
103
|
const omniChainKind = require_omni_bridge_utils.caip2ToChainKind(assetInfo.blockchain);
|
|
104
|
-
(0,
|
|
104
|
+
(0, lampamazaza_new_internal_utils.assert)(omniChainKind !== null, `Chain ${assetInfo.blockchain} is not supported by Omni Bridge`);
|
|
105
105
|
const intents = [];
|
|
106
106
|
if (args.feeEstimation.quote !== null) intents.push({
|
|
107
107
|
intent: "token_diff",
|
|
@@ -112,7 +112,7 @@ var OmniBridge = class {
|
|
|
112
112
|
referral: args.referral
|
|
113
113
|
});
|
|
114
114
|
const relayerFee = require_estimate_fee.getUnderlyingFee(args.feeEstimation, require_route_enum.RouteEnum.OmniBridge, "relayerFee");
|
|
115
|
-
(0,
|
|
115
|
+
(0, lampamazaza_new_internal_utils.assert)(relayerFee >= 0n, `Invalid Omni bridge relayer fee: expected >= 0, got ${relayerFee}`);
|
|
116
116
|
let amount = args.withdrawalParams.amount;
|
|
117
117
|
let utxoMaxGasFee = null;
|
|
118
118
|
/**
|
|
@@ -131,8 +131,8 @@ var OmniBridge = class {
|
|
|
131
131
|
if (require_omni_bridge_utils.isUtxoChain(omniChainKind)) {
|
|
132
132
|
utxoMaxGasFee = require_estimate_fee.getUnderlyingFee(args.feeEstimation, require_route_enum.RouteEnum.OmniBridge, "utxoMaxGasFee");
|
|
133
133
|
const utxoProtocolFee = require_estimate_fee.getUnderlyingFee(args.feeEstimation, require_route_enum.RouteEnum.OmniBridge, "utxoProtocolFee");
|
|
134
|
-
(0,
|
|
135
|
-
(0,
|
|
134
|
+
(0, lampamazaza_new_internal_utils.assert)(utxoMaxGasFee !== void 0 && utxoMaxGasFee > 0n, `Invalid Omni Bridge utxo max gas fee: expected > 0, got ${utxoMaxGasFee}`);
|
|
135
|
+
(0, lampamazaza_new_internal_utils.assert)(utxoProtocolFee !== void 0 && utxoProtocolFee > 0n, `Invalid Omni Bridge utxo protocol fee: expected > 0, got ${utxoProtocolFee}`);
|
|
136
136
|
amount += utxoMaxGasFee + utxoProtocolFee;
|
|
137
137
|
}
|
|
138
138
|
intents.push(...require_omni_bridge_utils.createWithdrawIntentsPrimitive({
|
|
@@ -148,16 +148,16 @@ var OmniBridge = class {
|
|
|
148
148
|
return Promise.resolve(intents);
|
|
149
149
|
}
|
|
150
150
|
async validateWithdrawal(args) {
|
|
151
|
-
(0,
|
|
151
|
+
(0, lampamazaza_new_internal_utils.assert)(args.feeEstimation.amount > 0n, `Invalid Omni Bridge fee: expected > 0, got ${args.feeEstimation.amount}`);
|
|
152
152
|
const assetInfo = this.makeAssetInfo(args.assetId, args.routeConfig);
|
|
153
|
-
(0,
|
|
153
|
+
(0, lampamazaza_new_internal_utils.assert)(assetInfo !== null, `Asset ${args.assetId} is not supported by Omni Bridge`);
|
|
154
154
|
if (require_validateAddress.validateAddress(args.destinationAddress, assetInfo.blockchain) === false) throw new require_errors.InvalidDestinationAddressForWithdrawalError(args.destinationAddress, assetInfo.blockchain);
|
|
155
155
|
const omniChainKind = require_omni_bridge_utils.caip2ToChainKind(assetInfo.blockchain);
|
|
156
|
-
(0,
|
|
156
|
+
(0, lampamazaza_new_internal_utils.assert)(omniChainKind !== null, `Chain ${assetInfo.blockchain} is not supported by Omni Bridge`);
|
|
157
157
|
const destTokenAddress = await this.getCachedDestinationTokenAddress(assetInfo.contractId, omniChainKind);
|
|
158
158
|
if (destTokenAddress === null) throw new require_error.TokenNotFoundInDestinationChainError(args.assetId, assetInfo.blockchain);
|
|
159
159
|
const decimals = await this.getCachedTokenDecimals(destTokenAddress);
|
|
160
|
-
(0,
|
|
160
|
+
(0, lampamazaza_new_internal_utils.assert)(decimals !== null, `Failed to retrieve token decimals for address ${destTokenAddress} via OmniBridge contract.
|
|
161
161
|
Ensure the token is supported and the address is correct.`);
|
|
162
162
|
if ((0, _omni_bridge_core.verifyTransferAmount)(args.amount, 0n, decimals.origin_decimals, decimals.decimals) === false) throw new require_errors.MinWithdrawalAmountError((0, _omni_bridge_core.getMinimumTransferableAmount)(decimals.origin_decimals, decimals.decimals), args.amount, args.assetId);
|
|
163
163
|
const storageBalance = await require_omni_bridge_utils.getAccountOmniStorageBalance(this.nearProvider, this.envConfig.contractID);
|
|
@@ -166,30 +166,30 @@ var OmniBridge = class {
|
|
|
166
166
|
const utxoChainWithdrawal = require_omni_bridge_utils.isUtxoChain(omniChainKind);
|
|
167
167
|
if (utxoChainWithdrawal === false) {
|
|
168
168
|
const relayerFee = require_estimate_fee.getUnderlyingFee(args.feeEstimation, require_route_enum.RouteEnum.OmniBridge, "relayerFee");
|
|
169
|
-
(0,
|
|
169
|
+
(0, lampamazaza_new_internal_utils.assert)(require_estimate_fee.getUnderlyingFee(args.feeEstimation, require_route_enum.RouteEnum.OmniBridge, "relayerFee") > 0n, `Invalid Omni Bridge relayer fee for non UTXO chain withdrawal: expected > 0, got ${relayerFee}`);
|
|
170
170
|
}
|
|
171
171
|
if (utxoChainWithdrawal) {
|
|
172
|
-
const fee = await (0,
|
|
172
|
+
const fee = await (0, lampamazaza_new_internal_utils.withTimeout)(() => this.omniBridgeAPI.getFee((0, _omni_bridge_core.omniAddress)(_omni_bridge_core.ChainKind.Near, this.envConfig.contractID), (0, _omni_bridge_core.omniAddress)(omniChainKind, args.destinationAddress), (0, _omni_bridge_core.omniAddress)(_omni_bridge_core.ChainKind.Near, assetInfo.contractId), args.amount), {
|
|
173
173
|
timeout: typeof window !== "undefined" ? 1e4 : 3e3,
|
|
174
174
|
errorInstance: new require_error.OmniWithdrawalApiFeeRequestTimeoutError()
|
|
175
175
|
});
|
|
176
176
|
if (fee.insufficient_utxo) throw new require_error.InsufficientUtxoForOmniBridgeWithdrawalError(assetInfo.blockchain);
|
|
177
|
-
(0,
|
|
177
|
+
(0, lampamazaza_new_internal_utils.assert)(fee.min_amount !== null && fee.min_amount !== void 0 && BigInt(fee.min_amount) > 0n, `Invalid min amount value for a UTXO chain withdrawal: expected > 0, got ${fee.min_amount}`);
|
|
178
178
|
const minAmount = BigInt(fee.min_amount);
|
|
179
179
|
const utxoMaxGasFee = require_estimate_fee.getUnderlyingFee(args.feeEstimation, require_route_enum.RouteEnum.OmniBridge, "utxoMaxGasFee");
|
|
180
180
|
const utxoProtocolFee = require_estimate_fee.getUnderlyingFee(args.feeEstimation, require_route_enum.RouteEnum.OmniBridge, "utxoProtocolFee");
|
|
181
|
-
(0,
|
|
182
|
-
(0,
|
|
181
|
+
(0, lampamazaza_new_internal_utils.assert)(utxoMaxGasFee !== void 0 && utxoMaxGasFee > 0n, `Invalid Omni Bridge utxo max gas fee: expected > 0, got ${utxoMaxGasFee}`);
|
|
182
|
+
(0, lampamazaza_new_internal_utils.assert)(utxoProtocolFee !== void 0 && utxoProtocolFee > 0n, `Invalid Omni Bridge utxo protocol fee: expected > 0, got ${utxoProtocolFee}`);
|
|
183
183
|
const actualAmountWithFee = args.amount + utxoMaxGasFee + utxoProtocolFee;
|
|
184
184
|
if (actualAmountWithFee < minAmount) throw new require_errors.MinWithdrawalAmountError(minAmount, actualAmountWithFee, args.assetId);
|
|
185
185
|
}
|
|
186
186
|
}
|
|
187
187
|
async estimateWithdrawalFee(args) {
|
|
188
188
|
const assetInfo = this.makeAssetInfo(args.withdrawalParams.assetId, args.withdrawalParams.routeConfig);
|
|
189
|
-
(0,
|
|
189
|
+
(0, lampamazaza_new_internal_utils.assert)(assetInfo !== null, `Asset ${args.withdrawalParams.assetId} is not supported by Omni Bridge`);
|
|
190
190
|
const omniChainKind = require_omni_bridge_utils.caip2ToChainKind(assetInfo.blockchain);
|
|
191
|
-
(0,
|
|
192
|
-
const fee = await (0,
|
|
191
|
+
(0, lampamazaza_new_internal_utils.assert)(omniChainKind !== null, `Chain ${assetInfo.blockchain} is not supported by Omni Bridge`);
|
|
192
|
+
const fee = await (0, lampamazaza_new_internal_utils.withTimeout)(() => this.omniBridgeAPI.getFee((0, _omni_bridge_core.omniAddress)(_omni_bridge_core.ChainKind.Near, this.envConfig.contractID), (0, _omni_bridge_core.omniAddress)(omniChainKind, args.withdrawalParams.destinationAddress), (0, _omni_bridge_core.omniAddress)(_omni_bridge_core.ChainKind.Near, assetInfo.contractId), args.withdrawalParams.amount), {
|
|
193
193
|
timeout: typeof window !== "undefined" ? 1e4 : 3e3,
|
|
194
194
|
errorInstance: new require_error.OmniWithdrawalApiFeeRequestTimeoutError()
|
|
195
195
|
});
|
|
@@ -225,8 +225,8 @@ var OmniBridge = class {
|
|
|
225
225
|
amount += BigInt(quote.amount_in);
|
|
226
226
|
}
|
|
227
227
|
if (require_omni_bridge_utils.isUtxoChain(omniChainKind)) {
|
|
228
|
-
(0,
|
|
229
|
-
(0,
|
|
228
|
+
(0, lampamazaza_new_internal_utils.assert)(fee.gas_fee !== null && fee.gas_fee !== void 0 && fee.gas_fee > 0n, `Invalid Omni Bridge utxo gas fee: expected > 0, got ${fee.gas_fee}`);
|
|
229
|
+
(0, lampamazaza_new_internal_utils.assert)(fee.protocol_fee !== null && fee.protocol_fee !== void 0 && fee.protocol_fee > 0n, `Invalid Omni Bridge utxo protocol fee: expected > 0, got ${fee.protocol_fee}`);
|
|
230
230
|
amount += fee.gas_fee + fee.protocol_fee;
|
|
231
231
|
underlyingFees.utxoMaxGasFee = fee.gas_fee;
|
|
232
232
|
underlyingFees.utxoProtocolFee = fee.protocol_fee;
|
|
@@ -239,7 +239,7 @@ var OmniBridge = class {
|
|
|
239
239
|
}
|
|
240
240
|
createWithdrawalIdentifier(args) {
|
|
241
241
|
const assetInfo = this.makeAssetInfo(args.withdrawalParams.assetId, args.withdrawalParams.routeConfig);
|
|
242
|
-
(0,
|
|
242
|
+
(0, lampamazaza_new_internal_utils.assert)(assetInfo !== null, `Asset ${args.withdrawalParams.assetId} is not supported by Omni Bridge`);
|
|
243
243
|
return {
|
|
244
244
|
landingChain: args.withdrawalParams.routeConfig != null && "chain" in args.withdrawalParams.routeConfig && args.withdrawalParams.routeConfig.chain !== void 0 ? args.withdrawalParams.routeConfig.chain : assetInfo.blockchain,
|
|
245
245
|
index: args.index,
|
|
@@ -271,10 +271,10 @@ var OmniBridge = class {
|
|
|
271
271
|
async getCachedStorageDepositValue(contractId) {
|
|
272
272
|
const cached = this.storageDepositCache.get(contractId);
|
|
273
273
|
if (cached !== void 0) return cached;
|
|
274
|
-
const result = await Promise.all([(0,
|
|
274
|
+
const result = await Promise.all([(0, lampamazaza_new_internal_utils.getNearNep141MinStorageBalance)({
|
|
275
275
|
contractId,
|
|
276
276
|
nearProvider: this.nearProvider
|
|
277
|
-
}), (0,
|
|
277
|
+
}), (0, lampamazaza_new_internal_utils.getNearNep141StorageBalance)({
|
|
278
278
|
contractId,
|
|
279
279
|
accountId: require_omni_bridge_constants.OMNI_BRIDGE_CONTRACT,
|
|
280
280
|
nearProvider: this.nearProvider
|
|
@@ -8,7 +8,7 @@ import { InsufficientUtxoForOmniBridgeWithdrawalError, IntentsNearOmniAvailableB
|
|
|
8
8
|
import { MIN_ALLOWED_STORAGE_BALANCE_FOR_INTENTS_NEAR, NEAR_NATIVE_ASSET_ID, OMNI_BRIDGE_CONTRACT } from "./omni-bridge-constants.js";
|
|
9
9
|
import { POA_TOKENS_ROUTABLE_THROUGH_OMNI_BRIDGE } from "../../constants/poa-tokens-routable-through-omni-bridge.js";
|
|
10
10
|
import { caip2ToChainKind, chainKindToCaip2, createWithdrawIntentsPrimitive, getAccountOmniStorageBalance, getBridgedToken, getTokenDecimals, isUtxoChain, poaContractIdToChainKind, validateOmniToken } from "./omni-bridge-utils.js";
|
|
11
|
-
import { assert, getNearNep141MinStorageBalance, getNearNep141StorageBalance, withTimeout } from "lampamazaza-internal-utils";
|
|
11
|
+
import { assert, getNearNep141MinStorageBalance, getNearNep141StorageBalance, withTimeout } from "lampamazaza-new-internal-utils";
|
|
12
12
|
import { LRUCache } from "lru-cache";
|
|
13
13
|
import TTLCache from "@isaacs/ttlcache";
|
|
14
14
|
import { BridgeAPI, ChainKind, getChain, getMinimumTransferableAmount, isEvmChain, omniAddress, parseOriginChain, verifyTransferAmount } from "@omni-bridge/core";
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
const require_rolldown_runtime = require('../../../_virtual/rolldown_runtime.cjs');
|
|
2
2
|
const require_caip2 = require('../../lib/caip2.cjs');
|
|
3
3
|
const require_poa_constants = require('./poa-constants.cjs');
|
|
4
|
-
let
|
|
4
|
+
let lampamazaza_new_internal_utils = require("lampamazaza-new-internal-utils");
|
|
5
5
|
|
|
6
6
|
//#region src/bridges/poa-bridge/poa-bridge-utils.ts
|
|
7
7
|
function createWithdrawIntentPrimitive(params) {
|
|
8
|
-
const { contractId: tokenAccountId } =
|
|
8
|
+
const { contractId: tokenAccountId } = lampamazaza_new_internal_utils.utils.parseDefuseAssetId(params.assetId);
|
|
9
9
|
return {
|
|
10
10
|
intent: "ft_withdraw",
|
|
11
11
|
token: tokenAccountId,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Chains } from "../../lib/caip2.js";
|
|
2
2
|
import { MIN_GAS_AMOUNT } from "./poa-constants.js";
|
|
3
|
-
import { utils } from "lampamazaza-internal-utils";
|
|
3
|
+
import { utils } from "lampamazaza-new-internal-utils";
|
|
4
4
|
|
|
5
5
|
//#region src/bridges/poa-bridge/poa-bridge-utils.ts
|
|
6
6
|
function createWithdrawIntentPrimitive(params) {
|
|
@@ -7,7 +7,7 @@ const require_validateAddress = require('../../lib/validateAddress.cjs');
|
|
|
7
7
|
const require_bridge_name_enum = require('../../constants/bridge-name-enum.cjs');
|
|
8
8
|
const require_poa_tokens_routable_through_omni_bridge = require('../../constants/poa-tokens-routable-through-omni-bridge.cjs');
|
|
9
9
|
const require_poa_bridge_utils = require('./poa-bridge-utils.cjs');
|
|
10
|
-
let
|
|
10
|
+
let lampamazaza_new_internal_utils = require("lampamazaza-new-internal-utils");
|
|
11
11
|
let _isaacs_ttlcache = require("@isaacs/ttlcache");
|
|
12
12
|
_isaacs_ttlcache = require_rolldown_runtime.__toESM(_isaacs_ttlcache);
|
|
13
13
|
|
|
@@ -52,7 +52,7 @@ var PoaBridge = class {
|
|
|
52
52
|
}
|
|
53
53
|
createWithdrawalIntents(args) {
|
|
54
54
|
const relayerFee = require_estimate_fee.getUnderlyingFee(args.feeEstimation, require_route_enum.RouteEnum.PoaBridge, "relayerFee");
|
|
55
|
-
(0,
|
|
55
|
+
(0, lampamazaza_new_internal_utils.assert)(relayerFee > 0n, `Invalid POA bridge relayer fee: expected > 0, got ${relayerFee}`);
|
|
56
56
|
const intent = require_poa_bridge_utils.createWithdrawIntentPrimitive({
|
|
57
57
|
...args.withdrawalParams,
|
|
58
58
|
amount: args.withdrawalParams.amount + relayerFee,
|
|
@@ -68,7 +68,7 @@ var PoaBridge = class {
|
|
|
68
68
|
*/
|
|
69
69
|
async validateWithdrawal(args) {
|
|
70
70
|
const assetInfo = this.parseAssetId(args.assetId);
|
|
71
|
-
(0,
|
|
71
|
+
(0, lampamazaza_new_internal_utils.assert)(assetInfo != null, "Asset is not supported");
|
|
72
72
|
if (require_validateAddress.validateAddress(args.destinationAddress, assetInfo.blockchain) === false) throw new require_errors.InvalidDestinationAddressForWithdrawalError(args.destinationAddress, assetInfo.blockchain);
|
|
73
73
|
const { tokens } = await this.getCachedSupportedTokens([require_poa_bridge_utils.toPoaNetwork(assetInfo.blockchain)], args.logger);
|
|
74
74
|
const tokenInfo = tokens.find((token) => token.intents_token_id === args.assetId);
|
|
@@ -79,9 +79,9 @@ var PoaBridge = class {
|
|
|
79
79
|
}
|
|
80
80
|
async estimateWithdrawalFee(args) {
|
|
81
81
|
const assetInfo = this.parseAssetId(args.withdrawalParams.assetId);
|
|
82
|
-
(0,
|
|
83
|
-
const estimation = await
|
|
84
|
-
token:
|
|
82
|
+
(0, lampamazaza_new_internal_utils.assert)(assetInfo != null, "Asset is not supported");
|
|
83
|
+
const estimation = await lampamazaza_new_internal_utils.poaBridge.httpClient.getWithdrawalEstimate({
|
|
84
|
+
token: lampamazaza_new_internal_utils.utils.getTokenAccountId(args.withdrawalParams.assetId),
|
|
85
85
|
address: args.withdrawalParams.destinationAddress,
|
|
86
86
|
chain: require_poa_bridge_utils.toPoaNetwork(assetInfo.blockchain)
|
|
87
87
|
}, {
|
|
@@ -89,7 +89,7 @@ var PoaBridge = class {
|
|
|
89
89
|
logger: args.logger
|
|
90
90
|
});
|
|
91
91
|
const relayerFee = BigInt(estimation.withdrawalFee);
|
|
92
|
-
(0,
|
|
92
|
+
(0, lampamazaza_new_internal_utils.assert)(relayerFee > 0n, `Invalid POA bridge relayer fee: expected > 0, got ${relayerFee}`);
|
|
93
93
|
return {
|
|
94
94
|
amount: relayerFee,
|
|
95
95
|
quote: null,
|
|
@@ -98,7 +98,7 @@ var PoaBridge = class {
|
|
|
98
98
|
}
|
|
99
99
|
createWithdrawalIdentifier(args) {
|
|
100
100
|
const assetInfo = this.parseAssetId(args.withdrawalParams.assetId);
|
|
101
|
-
(0,
|
|
101
|
+
(0, lampamazaza_new_internal_utils.assert)(assetInfo != null, "Asset is not supported");
|
|
102
102
|
return {
|
|
103
103
|
landingChain: assetInfo.blockchain,
|
|
104
104
|
index: args.index,
|
|
@@ -122,7 +122,7 @@ var PoaBridge = class {
|
|
|
122
122
|
async getWithdrawalStatusWithRetry(args) {
|
|
123
123
|
const startTime = Date.now();
|
|
124
124
|
while (true) try {
|
|
125
|
-
return await
|
|
125
|
+
return await lampamazaza_new_internal_utils.poaBridge.httpClient.getWithdrawalStatus({ withdrawal_hash: args.tx.hash }, {
|
|
126
126
|
baseURL: this.getPoaBridgeBaseURL(),
|
|
127
127
|
logger: args.logger
|
|
128
128
|
});
|
|
@@ -141,7 +141,7 @@ var PoaBridge = class {
|
|
|
141
141
|
const cacheKey = chains.sort().join(",");
|
|
142
142
|
const cached = this.supportedTokensCache.get(cacheKey);
|
|
143
143
|
if (cached != null) return cached;
|
|
144
|
-
const data = await
|
|
144
|
+
const data = await lampamazaza_new_internal_utils.poaBridge.httpClient.getSupportedTokens({ chains }, {
|
|
145
145
|
baseURL: this.getPoaBridgeBaseURL(),
|
|
146
146
|
logger
|
|
147
147
|
});
|
|
@@ -165,7 +165,7 @@ const NOT_FOUND_RETRY_TIMEOUT_MS = 3 * 1e3;
|
|
|
165
165
|
const NOT_FOUND_RETRY_INTERVAL_MS = 1e3;
|
|
166
166
|
const RPC_ERR_MSG_WITHDRAWALS_NOT_FOUND = "Withdrawals not found";
|
|
167
167
|
function isWithdrawalNotFoundError(err) {
|
|
168
|
-
return err instanceof
|
|
168
|
+
return err instanceof lampamazaza_new_internal_utils.RpcRequestError && err.details === RPC_ERR_MSG_WITHDRAWALS_NOT_FOUND;
|
|
169
169
|
}
|
|
170
170
|
function sleep(ms) {
|
|
171
171
|
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
@@ -6,7 +6,7 @@ import { validateAddress } from "../../lib/validateAddress.js";
|
|
|
6
6
|
import { BridgeNameEnum } from "../../constants/bridge-name-enum.js";
|
|
7
7
|
import { POA_TOKENS_ROUTABLE_THROUGH_OMNI_BRIDGE } from "../../constants/poa-tokens-routable-through-omni-bridge.js";
|
|
8
8
|
import { contractIdToCaip2, createWithdrawIntentPrimitive, toPoaNetwork } from "./poa-bridge-utils.js";
|
|
9
|
-
import { RpcRequestError, assert, poaBridge, utils } from "lampamazaza-internal-utils";
|
|
9
|
+
import { RpcRequestError, assert, poaBridge, utils } from "lampamazaza-new-internal-utils";
|
|
10
10
|
import TTLCache from "@isaacs/ttlcache";
|
|
11
11
|
|
|
12
12
|
//#region src/bridges/poa-bridge/poa-bridge.ts
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
const require_rolldown_runtime = require('../../_virtual/rolldown_runtime.cjs');
|
|
2
|
-
let
|
|
2
|
+
let lampamazaza_new_internal_utils = require("lampamazaza-new-internal-utils");
|
|
3
3
|
|
|
4
4
|
//#region src/classes/errors.ts
|
|
5
|
-
var FeeExceedsAmountError = class extends
|
|
5
|
+
var FeeExceedsAmountError = class extends lampamazaza_new_internal_utils.BaseError {
|
|
6
6
|
constructor(feeEstimation, amount) {
|
|
7
7
|
super("Amount too small to pay fee.", {
|
|
8
8
|
metaMessages: [`Required fee: ${feeEstimation.amount}`, `Withdrawal amount: ${amount}`],
|
|
@@ -12,7 +12,7 @@ var FeeExceedsAmountError = class extends lampamazaza_internal_utils.BaseError {
|
|
|
12
12
|
this.amount = amount;
|
|
13
13
|
}
|
|
14
14
|
};
|
|
15
|
-
var MinWithdrawalAmountError = class extends
|
|
15
|
+
var MinWithdrawalAmountError = class extends lampamazaza_new_internal_utils.BaseError {
|
|
16
16
|
constructor(minAmount, requestedAmount, assetId) {
|
|
17
17
|
super("Withdrawal amount is below minimum required by the bridge.", {
|
|
18
18
|
metaMessages: [
|
|
@@ -27,7 +27,7 @@ var MinWithdrawalAmountError = class extends lampamazaza_internal_utils.BaseErro
|
|
|
27
27
|
this.assetId = assetId;
|
|
28
28
|
}
|
|
29
29
|
};
|
|
30
|
-
var UnsupportedDestinationMemoError = class extends
|
|
30
|
+
var UnsupportedDestinationMemoError = class extends lampamazaza_new_internal_utils.BaseError {
|
|
31
31
|
constructor(blockchain, assetId) {
|
|
32
32
|
super("Destination memo is not supported for this blockchain.", {
|
|
33
33
|
details: "Destination memo is only supported for XRP Ledger withdrawals.",
|
|
@@ -38,7 +38,7 @@ var UnsupportedDestinationMemoError = class extends lampamazaza_internal_utils.B
|
|
|
38
38
|
this.assetId = assetId;
|
|
39
39
|
}
|
|
40
40
|
};
|
|
41
|
-
var TrustlineNotFoundError = class extends
|
|
41
|
+
var TrustlineNotFoundError = class extends lampamazaza_new_internal_utils.BaseError {
|
|
42
42
|
constructor(destinationAddress, assetId, blockchain, tokenAddress) {
|
|
43
43
|
super("Destination address does not have a trustline for this asset.", {
|
|
44
44
|
details: "The destination address must establish a trustline before receiving this asset.",
|
|
@@ -56,7 +56,7 @@ var TrustlineNotFoundError = class extends lampamazaza_internal_utils.BaseError
|
|
|
56
56
|
this.tokenAddress = tokenAddress;
|
|
57
57
|
}
|
|
58
58
|
};
|
|
59
|
-
var UnsupportedAssetIdError = class extends
|
|
59
|
+
var UnsupportedAssetIdError = class extends lampamazaza_new_internal_utils.BaseError {
|
|
60
60
|
constructor(assetId, details) {
|
|
61
61
|
super("Asset ID is not supported.", {
|
|
62
62
|
details,
|
|
@@ -66,7 +66,7 @@ var UnsupportedAssetIdError = class extends lampamazaza_internal_utils.BaseError
|
|
|
66
66
|
this.assetId = assetId;
|
|
67
67
|
}
|
|
68
68
|
};
|
|
69
|
-
var InvalidDestinationAddressForWithdrawalError = class extends
|
|
69
|
+
var InvalidDestinationAddressForWithdrawalError = class extends lampamazaza_new_internal_utils.BaseError {
|
|
70
70
|
constructor(destinationAddress, destinationChain) {
|
|
71
71
|
super(`Invalid destination address.`, {
|
|
72
72
|
metaMessages: [`Destination address: ${destinationAddress}`, `Destination chain: ${destinationChain}`],
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { FeeEstimation } from "../shared-types.cjs";
|
|
2
|
-
import { BaseError } from "lampamazaza-internal-utils";
|
|
2
|
+
import { BaseError } from "lampamazaza-new-internal-utils";
|
|
3
3
|
|
|
4
4
|
//#region src/classes/errors.d.ts
|
|
5
5
|
type FeeExceedsAmountErrorType = FeeExceedsAmountError & {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { FeeEstimation } from "../shared-types.js";
|
|
2
|
-
import { BaseError } from "lampamazaza-internal-utils";
|
|
2
|
+
import { BaseError } from "lampamazaza-new-internal-utils";
|
|
3
3
|
|
|
4
4
|
//#region src/classes/errors.d.ts
|
|
5
5
|
type FeeExceedsAmountErrorType = FeeExceedsAmountError & {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
const require_rolldown_runtime = require('../../_virtual/rolldown_runtime.cjs');
|
|
2
2
|
const require_withdrawal_timing = require('../constants/withdrawal-timing.cjs');
|
|
3
|
-
let
|
|
3
|
+
let lampamazaza_new_internal_utils = require("lampamazaza-new-internal-utils");
|
|
4
4
|
|
|
5
5
|
//#region src/core/withdrawal-watcher.ts
|
|
6
6
|
const MAX_CONSECUTIVE_ERRORS = 3;
|
|
@@ -11,7 +11,7 @@ async function watchWithdrawal(args) {
|
|
|
11
11
|
});
|
|
12
12
|
let consecutiveErrors = 0;
|
|
13
13
|
try {
|
|
14
|
-
return await (0,
|
|
14
|
+
return await (0, lampamazaza_new_internal_utils.poll)(async () => {
|
|
15
15
|
try {
|
|
16
16
|
const status = await args.bridge.describeWithdrawal({
|
|
17
17
|
...args.wid,
|
|
@@ -20,20 +20,20 @@ async function watchWithdrawal(args) {
|
|
|
20
20
|
consecutiveErrors = 0;
|
|
21
21
|
if (status.status === "completed") return status.txHash != null ? { hash: status.txHash } : { hash: null };
|
|
22
22
|
if (status.status === "failed") throw new WithdrawalFailedError(status.reason);
|
|
23
|
-
return
|
|
23
|
+
return lampamazaza_new_internal_utils.POLL_PENDING;
|
|
24
24
|
} catch (err) {
|
|
25
25
|
if (err instanceof WithdrawalFailedError) throw err;
|
|
26
26
|
consecutiveErrors++;
|
|
27
27
|
if (consecutiveErrors >= MAX_CONSECUTIVE_ERRORS) throw new WithdrawalWatchError(err);
|
|
28
28
|
args.logger?.warn(`Transient error (${consecutiveErrors}/${MAX_CONSECUTIVE_ERRORS}): ${err}`);
|
|
29
|
-
return
|
|
29
|
+
return lampamazaza_new_internal_utils.POLL_PENDING;
|
|
30
30
|
}
|
|
31
31
|
}, {
|
|
32
32
|
stats,
|
|
33
33
|
signal: args.signal
|
|
34
34
|
});
|
|
35
35
|
} catch (err) {
|
|
36
|
-
if (err instanceof
|
|
36
|
+
if (err instanceof lampamazaza_new_internal_utils.PollTimeoutError) throw new WithdrawalWatchError(err);
|
|
37
37
|
throw err;
|
|
38
38
|
}
|
|
39
39
|
}
|
|
@@ -60,17 +60,17 @@ async function createWithdrawalIdentifiers(args) {
|
|
|
60
60
|
async function findBridgeForWithdrawal(bridges, params) {
|
|
61
61
|
for (const bridge of bridges) if (await bridge.supports(params)) return bridge;
|
|
62
62
|
}
|
|
63
|
-
var BridgeNotFoundError = class extends
|
|
63
|
+
var BridgeNotFoundError = class extends lampamazaza_new_internal_utils.BaseError {
|
|
64
64
|
constructor() {
|
|
65
65
|
super("Bridge adapter not found", { name: "BridgeNotFoundError" });
|
|
66
66
|
}
|
|
67
67
|
};
|
|
68
|
-
var WithdrawalFailedError = class extends
|
|
68
|
+
var WithdrawalFailedError = class extends lampamazaza_new_internal_utils.BaseError {
|
|
69
69
|
constructor(reason) {
|
|
70
70
|
super(`Withdrawal failed: ${reason}`, { name: "WithdrawalFailedError" });
|
|
71
71
|
}
|
|
72
72
|
};
|
|
73
|
-
var WithdrawalWatchError = class extends
|
|
73
|
+
var WithdrawalWatchError = class extends lampamazaza_new_internal_utils.BaseError {
|
|
74
74
|
constructor(cause) {
|
|
75
75
|
super("Withdrawal watch failed", {
|
|
76
76
|
name: "WithdrawalWatchError",
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { getWithdrawalStatsForChain } from "../constants/withdrawal-timing.js";
|
|
2
|
-
import { BaseError, POLL_PENDING, PollTimeoutError, poll } from "lampamazaza-internal-utils";
|
|
2
|
+
import { BaseError, POLL_PENDING, PollTimeoutError, poll } from "lampamazaza-new-internal-utils";
|
|
3
3
|
|
|
4
4
|
//#region src/core/withdrawal-watcher.ts
|
|
5
5
|
const MAX_CONSECUTIVE_ERRORS = 3;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { IntentHash, IntentPayload, MultiPayload, RelayParamsDefault } from "../shared-types.cjs";
|
|
2
|
-
import { EnvConfig, ILogger } from "lampamazaza-internal-utils";
|
|
2
|
+
import { EnvConfig, ILogger } from "lampamazaza-new-internal-utils";
|
|
3
3
|
|
|
4
4
|
//#region src/intents/intent-executer-impl/intent-executer.d.ts
|
|
5
5
|
|
|
@@ -3,7 +3,7 @@ import { IntentHash, IntentPayload, MultiPayload, RelayParamsDefault } from "../
|
|
|
3
3
|
import "../interfaces/intent-executer.js";
|
|
4
4
|
import "../../shared-types.js";
|
|
5
5
|
import "../interfaces/intent-relayer.js";
|
|
6
|
-
import { EnvConfig, ILogger } from "lampamazaza-internal-utils";
|
|
6
|
+
import { EnvConfig, ILogger } from "lampamazaza-new-internal-utils";
|
|
7
7
|
|
|
8
8
|
//#region src/intents/intent-executer-impl/intent-executer.d.ts
|
|
9
9
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
const require_rolldown_runtime = require('../../../_virtual/rolldown_runtime.cjs');
|
|
2
|
-
let
|
|
2
|
+
let lampamazaza_new_internal_utils = require("lampamazaza-new-internal-utils");
|
|
3
3
|
let _noble_hashes_sha2 = require("@noble/hashes/sha2");
|
|
4
4
|
|
|
5
5
|
//#region src/intents/intent-hashes/sep53.ts
|
|
@@ -10,7 +10,7 @@ let _noble_hashes_sha2 = require("@noble/hashes/sha2");
|
|
|
10
10
|
function computeSep53Prehash(payload) {
|
|
11
11
|
const prefix = new TextEncoder().encode("Stellar Signed Message:\n");
|
|
12
12
|
const data = new TextEncoder().encode(payload);
|
|
13
|
-
return
|
|
13
|
+
return lampamazaza_new_internal_utils.utils.concatUint8Arrays([prefix, data]);
|
|
14
14
|
}
|
|
15
15
|
/**
|
|
16
16
|
* Compute the SHA-256 hash of a SEP-53 payload
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
const require_rolldown_runtime = require('../../_virtual/rolldown_runtime.cjs');
|
|
2
2
|
const require_expirable_nonce = require('./expirable-nonce.cjs');
|
|
3
3
|
const require_intent_payload_factory = require('./intent-payload-factory.cjs');
|
|
4
|
-
let
|
|
4
|
+
let lampamazaza_new_internal_utils = require("lampamazaza-new-internal-utils");
|
|
5
5
|
|
|
6
6
|
//#region src/intents/intent-payload-builder.ts
|
|
7
7
|
/**
|
|
@@ -44,7 +44,7 @@ var IntentPayloadBuilder = class IntentPayloadBuilder {
|
|
|
44
44
|
* @throws Error if signerId is not a valid NEAR account ID
|
|
45
45
|
*/
|
|
46
46
|
setSigner(signerId) {
|
|
47
|
-
if (!
|
|
47
|
+
if (!lampamazaza_new_internal_utils.utils.validateNearAddress(signerId)) throw new Error(`Invalid signer_id: "${signerId}" is not a valid NEAR account ID`);
|
|
48
48
|
this.signerId = signerId;
|
|
49
49
|
return this;
|
|
50
50
|
}
|
|
@@ -2,7 +2,7 @@ import { Salt } from "./expirable-nonce.cjs";
|
|
|
2
2
|
import { IntentPayload, IntentPrimitive, MultiPayload } from "./shared-types.cjs";
|
|
3
3
|
import { IIntentSigner } from "./interfaces/intent-signer.cjs";
|
|
4
4
|
import { ISaltManager } from "./interfaces/salt-manager.cjs";
|
|
5
|
-
import { EnvConfig } from "lampamazaza-internal-utils";
|
|
5
|
+
import { EnvConfig } from "lampamazaza-new-internal-utils";
|
|
6
6
|
|
|
7
7
|
//#region src/intents/intent-payload-builder.d.ts
|
|
8
8
|
interface IntentPayloadBuilderConfig {
|
|
@@ -2,7 +2,7 @@ import { Salt } from "./expirable-nonce.js";
|
|
|
2
2
|
import { IntentPayload, IntentPrimitive, MultiPayload } from "./shared-types.js";
|
|
3
3
|
import { IIntentSigner } from "./interfaces/intent-signer.js";
|
|
4
4
|
import { ISaltManager } from "./interfaces/salt-manager.js";
|
|
5
|
-
import { EnvConfig } from "lampamazaza-internal-utils";
|
|
5
|
+
import { EnvConfig } from "lampamazaza-new-internal-utils";
|
|
6
6
|
|
|
7
7
|
//#region src/intents/intent-payload-builder.d.ts
|
|
8
8
|
interface IntentPayloadBuilderConfig {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { VersionedNonceBuilder } from "./expirable-nonce.js";
|
|
2
2
|
import { DEFAULT_DEADLINE_MS, DEFAULT_NONCE_DEADLINE_OFFSET_MS } from "./intent-payload-factory.js";
|
|
3
|
-
import { utils } from "lampamazaza-internal-utils";
|
|
3
|
+
import { utils } from "lampamazaza-new-internal-utils";
|
|
4
4
|
|
|
5
5
|
//#region src/intents/intent-payload-builder.ts
|
|
6
6
|
/**
|