lampamazaza-new-intents-sdk 0.47.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/LICENSE +21 -0
- package/README.md +1083 -0
- package/dist/_virtual/rolldown_runtime.cjs +29 -0
- package/dist/index.cjs +124 -0
- package/dist/index.d.cts +22 -0
- package/dist/index.d.ts +22 -0
- package/dist/index.js +19 -0
- package/dist/src/bridges/aurora-engine-bridge/aurora-engine-bridge-constants.cjs +10 -0
- package/dist/src/bridges/aurora-engine-bridge/aurora-engine-bridge-constants.js +7 -0
- package/dist/src/bridges/aurora-engine-bridge/aurora-engine-bridge-utils.cjs +44 -0
- package/dist/src/bridges/aurora-engine-bridge/aurora-engine-bridge-utils.js +42 -0
- package/dist/src/bridges/aurora-engine-bridge/aurora-engine-bridge.cjs +111 -0
- package/dist/src/bridges/aurora-engine-bridge/aurora-engine-bridge.js +110 -0
- package/dist/src/bridges/direct-bridge/direct-bridge-constants.cjs +8 -0
- package/dist/src/bridges/direct-bridge/direct-bridge-constants.js +6 -0
- package/dist/src/bridges/direct-bridge/direct-bridge-utils.cjs +47 -0
- package/dist/src/bridges/direct-bridge/direct-bridge-utils.js +44 -0
- package/dist/src/bridges/direct-bridge/direct-bridge.cjs +155 -0
- package/dist/src/bridges/direct-bridge/direct-bridge.js +154 -0
- package/dist/src/bridges/direct-bridge/error.cjs +16 -0
- package/dist/src/bridges/direct-bridge/error.d.cts +12 -0
- package/dist/src/bridges/direct-bridge/error.d.ts +12 -0
- package/dist/src/bridges/direct-bridge/error.js +15 -0
- package/dist/src/bridges/hot-bridge/error.cjs +23 -0
- package/dist/src/bridges/hot-bridge/error.d.cts +19 -0
- package/dist/src/bridges/hot-bridge/error.d.ts +19 -0
- package/dist/src/bridges/hot-bridge/error.js +21 -0
- package/dist/src/bridges/hot-bridge/hot-bridge-chains.cjs +21 -0
- package/dist/src/bridges/hot-bridge/hot-bridge-chains.d.cts +6 -0
- package/dist/src/bridges/hot-bridge/hot-bridge-chains.d.ts +6 -0
- package/dist/src/bridges/hot-bridge/hot-bridge-chains.js +20 -0
- package/dist/src/bridges/hot-bridge/hot-bridge-constants.cjs +11 -0
- package/dist/src/bridges/hot-bridge/hot-bridge-constants.js +9 -0
- package/dist/src/bridges/hot-bridge/hot-bridge-utils.cjs +66 -0
- package/dist/src/bridges/hot-bridge/hot-bridge-utils.js +61 -0
- package/dist/src/bridges/hot-bridge/hot-bridge.cjs +241 -0
- package/dist/src/bridges/hot-bridge/hot-bridge.js +239 -0
- package/dist/src/bridges/intents-bridge/intents-bridge.cjs +59 -0
- package/dist/src/bridges/intents-bridge/intents-bridge.js +59 -0
- package/dist/src/bridges/omni-bridge/error.cjs +54 -0
- package/dist/src/bridges/omni-bridge/error.d.cts +41 -0
- package/dist/src/bridges/omni-bridge/error.d.ts +41 -0
- package/dist/src/bridges/omni-bridge/error.js +49 -0
- package/dist/src/bridges/omni-bridge/omni-bridge-constants.cjs +12 -0
- package/dist/src/bridges/omni-bridge/omni-bridge-constants.js +8 -0
- package/dist/src/bridges/omni-bridge/omni-bridge-utils.cjs +153 -0
- package/dist/src/bridges/omni-bridge/omni-bridge-utils.js +143 -0
- package/dist/src/bridges/omni-bridge/omni-bridge.cjs +316 -0
- package/dist/src/bridges/omni-bridge/omni-bridge.js +314 -0
- package/dist/src/bridges/poa-bridge/poa-bridge-utils.cjs +76 -0
- package/dist/src/bridges/poa-bridge/poa-bridge-utils.js +73 -0
- package/dist/src/bridges/poa-bridge/poa-bridge.cjs +175 -0
- package/dist/src/bridges/poa-bridge/poa-bridge.js +173 -0
- package/dist/src/bridges/poa-bridge/poa-constants.cjs +6 -0
- package/dist/src/bridges/poa-bridge/poa-constants.js +5 -0
- package/dist/src/classes/errors.cjs +87 -0
- package/dist/src/classes/errors.d.cts +48 -0
- package/dist/src/classes/errors.d.ts +48 -0
- package/dist/src/classes/errors.js +81 -0
- package/dist/src/constants/bridge-name-enum.cjs +11 -0
- package/dist/src/constants/bridge-name-enum.d.cts +11 -0
- package/dist/src/constants/bridge-name-enum.d.ts +11 -0
- package/dist/src/constants/bridge-name-enum.js +10 -0
- package/dist/src/constants/poa-tokens-routable-through-omni-bridge.cjs +17 -0
- package/dist/src/constants/poa-tokens-routable-through-omni-bridge.d.cts +12 -0
- package/dist/src/constants/poa-tokens-routable-through-omni-bridge.d.ts +12 -0
- package/dist/src/constants/poa-tokens-routable-through-omni-bridge.js +16 -0
- package/dist/src/constants/public-rpc-urls.cjs +25 -0
- package/dist/src/constants/public-rpc-urls.js +24 -0
- package/dist/src/constants/route-enum.cjs +13 -0
- package/dist/src/constants/route-enum.d.cts +13 -0
- package/dist/src/constants/route-enum.d.ts +13 -0
- package/dist/src/constants/route-enum.js +12 -0
- package/dist/src/constants/withdrawal-timing.cjs +68 -0
- package/dist/src/constants/withdrawal-timing.js +68 -0
- package/dist/src/core/withdrawal-watcher.cjs +86 -0
- package/dist/src/core/withdrawal-watcher.d.cts +18 -0
- package/dist/src/core/withdrawal-watcher.d.ts +19 -0
- package/dist/src/core/withdrawal-watcher.js +82 -0
- package/dist/src/intents/expirable-nonce.cjs +90 -0
- package/dist/src/intents/expirable-nonce.d.cts +44 -0
- package/dist/src/intents/expirable-nonce.d.ts +45 -0
- package/dist/src/intents/expirable-nonce.js +82 -0
- package/dist/src/intents/intent-executer-impl/intent-executer.cjs +85 -0
- package/dist/src/intents/intent-executer-impl/intent-executer.d.cts +20 -0
- package/dist/src/intents/intent-executer-impl/intent-executer.d.ts +24 -0
- package/dist/src/intents/intent-executer-impl/intent-executer.js +85 -0
- package/dist/src/intents/intent-hash.cjs +48 -0
- package/dist/src/intents/intent-hash.d.cts +8 -0
- package/dist/src/intents/intent-hash.d.ts +8 -0
- package/dist/src/intents/intent-hash.js +47 -0
- package/dist/src/intents/intent-hashes/erc191.cjs +38 -0
- package/dist/src/intents/intent-hashes/erc191.js +37 -0
- package/dist/src/intents/intent-hashes/nep413.cjs +23 -0
- package/dist/src/intents/intent-hashes/nep413.js +22 -0
- package/dist/src/intents/intent-hashes/raw-ed25519.cjs +26 -0
- package/dist/src/intents/intent-hashes/raw-ed25519.js +25 -0
- package/dist/src/intents/intent-hashes/sep53.cjs +36 -0
- package/dist/src/intents/intent-hashes/sep53.js +35 -0
- package/dist/src/intents/intent-hashes/tip191.cjs +39 -0
- package/dist/src/intents/intent-hashes/tip191.js +38 -0
- package/dist/src/intents/intent-hashes/ton-connect.cjs +105 -0
- package/dist/src/intents/intent-hashes/ton-connect.js +104 -0
- package/dist/src/intents/intent-hashes/webauthn.cjs +26 -0
- package/dist/src/intents/intent-hashes/webauthn.js +25 -0
- package/dist/src/intents/intent-payload-builder.cjs +208 -0
- package/dist/src/intents/intent-payload-builder.d.cts +161 -0
- package/dist/src/intents/intent-payload-builder.d.ts +161 -0
- package/dist/src/intents/intent-payload-builder.js +207 -0
- package/dist/src/intents/intent-payload-factory.cjs +23 -0
- package/dist/src/intents/intent-payload-factory.js +21 -0
- package/dist/src/intents/intent-relayer-impl/intent-relayer-public.cjs +43 -0
- package/dist/src/intents/intent-relayer-impl/intent-relayer-public.js +42 -0
- package/dist/src/intents/intent-signer-impl/factories.cjs +19 -0
- package/dist/src/intents/intent-signer-impl/factories.d.cts +11 -0
- package/dist/src/intents/intent-signer-impl/factories.d.ts +11 -0
- package/dist/src/intents/intent-signer-impl/factories.js +17 -0
- package/dist/src/intents/intent-signer-impl/intent-signer-near-keypair.cjs +22 -0
- package/dist/src/intents/intent-signer-impl/intent-signer-near-keypair.d.cts +15 -0
- package/dist/src/intents/intent-signer-impl/intent-signer-near-keypair.d.ts +16 -0
- package/dist/src/intents/intent-signer-impl/intent-signer-near-keypair.js +21 -0
- package/dist/src/intents/intent-signer-impl/intent-signer-nep413.cjs +37 -0
- package/dist/src/intents/intent-signer-impl/intent-signer-nep413.d.cts +14 -0
- package/dist/src/intents/intent-signer-impl/intent-signer-nep413.d.ts +14 -0
- package/dist/src/intents/intent-signer-impl/intent-signer-nep413.js +36 -0
- package/dist/src/intents/intent-signer-impl/intent-signer-noop.cjs +8 -0
- package/dist/src/intents/intent-signer-impl/intent-signer-noop.js +7 -0
- package/dist/src/intents/intent-signer-impl/intent-signer-viem.cjs +31 -0
- package/dist/src/intents/intent-signer-impl/intent-signer-viem.d.cts +17 -0
- package/dist/src/intents/intent-signer-impl/intent-signer-viem.d.ts +17 -0
- package/dist/src/intents/intent-signer-impl/intent-signer-viem.js +30 -0
- package/dist/src/intents/interfaces/intent-executer.d.ts +2 -0
- package/dist/src/intents/interfaces/intent-relayer.d.cts +43 -0
- package/dist/src/intents/interfaces/intent-relayer.d.ts +43 -0
- package/dist/src/intents/interfaces/intent-signer.d.cts +8 -0
- package/dist/src/intents/interfaces/intent-signer.d.ts +8 -0
- package/dist/src/intents/interfaces/salt-manager.d.cts +9 -0
- package/dist/src/intents/interfaces/salt-manager.d.ts +9 -0
- package/dist/src/intents/salt-manager.cjs +74 -0
- package/dist/src/intents/salt-manager.js +72 -0
- package/dist/src/intents/shared-types.d.cts +20 -0
- package/dist/src/intents/shared-types.d.ts +20 -0
- package/dist/src/lib/array.cjs +11 -0
- package/dist/src/lib/array.js +10 -0
- package/dist/src/lib/caip2.cjs +50 -0
- package/dist/src/lib/caip2.d.cts +38 -0
- package/dist/src/lib/caip2.d.ts +38 -0
- package/dist/src/lib/caip2.js +48 -0
- package/dist/src/lib/configure-rpc-config.cjs +20 -0
- package/dist/src/lib/configure-rpc-config.js +18 -0
- package/dist/src/lib/estimate-fee.cjs +96 -0
- package/dist/src/lib/estimate-fee.js +94 -0
- package/dist/src/lib/hex.cjs +11 -0
- package/dist/src/lib/hex.js +10 -0
- package/dist/src/lib/nep413.cjs +42 -0
- package/dist/src/lib/nep413.d.cts +14 -0
- package/dist/src/lib/nep413.d.ts +14 -0
- package/dist/src/lib/nep413.js +41 -0
- package/dist/src/lib/object.cjs +10 -0
- package/dist/src/lib/object.js +9 -0
- package/dist/src/lib/parse-defuse-asset-id.cjs +15 -0
- package/dist/src/lib/parse-defuse-asset-id.js +14 -0
- package/dist/src/lib/route-config-factory.cjs +43 -0
- package/dist/src/lib/route-config-factory.d.cts +13 -0
- package/dist/src/lib/route-config-factory.d.ts +13 -0
- package/dist/src/lib/route-config-factory.js +37 -0
- package/dist/src/lib/tokensUsdPricesHttpClient/apis.cjs +17 -0
- package/dist/src/lib/tokensUsdPricesHttpClient/apis.js +16 -0
- package/dist/src/lib/validateAddress.cjs +271 -0
- package/dist/src/lib/validateAddress.d.cts +14 -0
- package/dist/src/lib/validateAddress.d.ts +14 -0
- package/dist/src/lib/validateAddress.js +270 -0
- package/dist/src/sdk.cjs +435 -0
- package/dist/src/sdk.d.cts +231 -0
- package/dist/src/sdk.d.ts +231 -0
- package/dist/src/sdk.js +433 -0
- package/dist/src/shared-types.d.cts +378 -0
- package/dist/src/shared-types.d.ts +378 -0
- package/package.json +62 -0
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
//#region rolldown:runtime
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __copyProps = (to, from, except, desc) => {
|
|
9
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
10
|
+
for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
|
|
11
|
+
key = keys[i];
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except) {
|
|
13
|
+
__defProp(to, key, {
|
|
14
|
+
get: ((k) => from[k]).bind(null, key),
|
|
15
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
return to;
|
|
21
|
+
};
|
|
22
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
23
|
+
value: mod,
|
|
24
|
+
enumerable: true
|
|
25
|
+
}) : target, mod));
|
|
26
|
+
|
|
27
|
+
//#endregion
|
|
28
|
+
|
|
29
|
+
exports.__toESM = __toESM;
|
package/dist/index.cjs
ADDED
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
const require_rolldown_runtime = require('./_virtual/rolldown_runtime.cjs');
|
|
2
|
+
const require_errors = require('./src/classes/errors.cjs');
|
|
3
|
+
const require_route_enum = require('./src/constants/route-enum.cjs');
|
|
4
|
+
const require_caip2 = require('./src/lib/caip2.cjs');
|
|
5
|
+
const require_validateAddress = require('./src/lib/validateAddress.cjs');
|
|
6
|
+
const require_bridge_name_enum = require('./src/constants/bridge-name-enum.cjs');
|
|
7
|
+
const require_error = require('./src/bridges/direct-bridge/error.cjs');
|
|
8
|
+
const require_error$1 = require('./src/bridges/hot-bridge/error.cjs');
|
|
9
|
+
const require_error$2 = require('./src/bridges/omni-bridge/error.cjs');
|
|
10
|
+
const require_poa_tokens_routable_through_omni_bridge = require('./src/constants/poa-tokens-routable-through-omni-bridge.cjs');
|
|
11
|
+
const require_intent_hash = require('./src/intents/intent-hash.cjs');
|
|
12
|
+
const require_expirable_nonce = require('./src/intents/expirable-nonce.cjs');
|
|
13
|
+
const require_withdrawal_watcher = require('./src/core/withdrawal-watcher.cjs');
|
|
14
|
+
const require_intent_payload_builder = require('./src/intents/intent-payload-builder.cjs');
|
|
15
|
+
const require_sdk = require('./src/sdk.cjs');
|
|
16
|
+
const require_factories = require('./src/intents/intent-signer-impl/factories.cjs');
|
|
17
|
+
const require_route_config_factory = require('./src/lib/route-config-factory.cjs');
|
|
18
|
+
let lampamazaza_internal_utils = require("lampamazaza-internal-utils");
|
|
19
|
+
|
|
20
|
+
Object.defineProperty(exports, 'AssertionError', {
|
|
21
|
+
enumerable: true,
|
|
22
|
+
get: function () {
|
|
23
|
+
return lampamazaza_internal_utils.AssertionError;
|
|
24
|
+
}
|
|
25
|
+
});
|
|
26
|
+
Object.defineProperty(exports, 'BaseError', {
|
|
27
|
+
enumerable: true,
|
|
28
|
+
get: function () {
|
|
29
|
+
return lampamazaza_internal_utils.BaseError;
|
|
30
|
+
}
|
|
31
|
+
});
|
|
32
|
+
exports.BridgeNameEnum = require_bridge_name_enum.BridgeNameEnum;
|
|
33
|
+
exports.Chains = require_caip2.Chains;
|
|
34
|
+
exports.DestinationExplicitNearAccountDoesntExistError = require_error.DestinationExplicitNearAccountDoesntExistError;
|
|
35
|
+
exports.FeeExceedsAmountError = require_errors.FeeExceedsAmountError;
|
|
36
|
+
exports.HotWithdrawalApiFeeRequestTimeoutError = require_error$1.HotWithdrawalApiFeeRequestTimeoutError;
|
|
37
|
+
exports.HotWithdrawalNotFoundError = require_error$1.HotWithdrawalNotFoundError;
|
|
38
|
+
Object.defineProperty(exports, 'HttpRequestError', {
|
|
39
|
+
enumerable: true,
|
|
40
|
+
get: function () {
|
|
41
|
+
return lampamazaza_internal_utils.HttpRequestError;
|
|
42
|
+
}
|
|
43
|
+
});
|
|
44
|
+
exports.InsufficientUtxoForOmniBridgeWithdrawalError = require_error$2.InsufficientUtxoForOmniBridgeWithdrawalError;
|
|
45
|
+
exports.IntentPayloadBuilder = require_intent_payload_builder.IntentPayloadBuilder;
|
|
46
|
+
Object.defineProperty(exports, 'IntentSettlementError', {
|
|
47
|
+
enumerable: true,
|
|
48
|
+
get: function () {
|
|
49
|
+
return lampamazaza_internal_utils.IntentSettlementError;
|
|
50
|
+
}
|
|
51
|
+
});
|
|
52
|
+
exports.IntentsNearOmniAvailableBalanceTooLowError = require_error$2.IntentsNearOmniAvailableBalanceTooLowError;
|
|
53
|
+
exports.IntentsSDK = require_sdk.IntentsSDK;
|
|
54
|
+
exports.InvalidFeeValueError = require_error$2.InvalidFeeValueError;
|
|
55
|
+
exports.MinWithdrawalAmountError = require_errors.MinWithdrawalAmountError;
|
|
56
|
+
exports.OmniWithdrawalApiFeeRequestTimeoutError = require_error$2.OmniWithdrawalApiFeeRequestTimeoutError;
|
|
57
|
+
exports.POA_TOKENS_ROUTABLE_THROUGH_OMNI_BRIDGE = require_poa_tokens_routable_through_omni_bridge.POA_TOKENS_ROUTABLE_THROUGH_OMNI_BRIDGE;
|
|
58
|
+
Object.defineProperty(exports, 'PoaWithdrawalInvariantError', {
|
|
59
|
+
enumerable: true,
|
|
60
|
+
get: function () {
|
|
61
|
+
return lampamazaza_internal_utils.PoaWithdrawalInvariantError;
|
|
62
|
+
}
|
|
63
|
+
});
|
|
64
|
+
Object.defineProperty(exports, 'PoaWithdrawalNotFoundError', {
|
|
65
|
+
enumerable: true,
|
|
66
|
+
get: function () {
|
|
67
|
+
return lampamazaza_internal_utils.PoaWithdrawalNotFoundError;
|
|
68
|
+
}
|
|
69
|
+
});
|
|
70
|
+
Object.defineProperty(exports, 'PoaWithdrawalPendingError', {
|
|
71
|
+
enumerable: true,
|
|
72
|
+
get: function () {
|
|
73
|
+
return lampamazaza_internal_utils.PoaWithdrawalPendingError;
|
|
74
|
+
}
|
|
75
|
+
});
|
|
76
|
+
Object.defineProperty(exports, 'QuoteError', {
|
|
77
|
+
enumerable: true,
|
|
78
|
+
get: function () {
|
|
79
|
+
return lampamazaza_internal_utils.QuoteError;
|
|
80
|
+
}
|
|
81
|
+
});
|
|
82
|
+
Object.defineProperty(exports, 'RelayPublishError', {
|
|
83
|
+
enumerable: true,
|
|
84
|
+
get: function () {
|
|
85
|
+
return lampamazaza_internal_utils.RelayPublishError;
|
|
86
|
+
}
|
|
87
|
+
});
|
|
88
|
+
exports.RouteEnum = require_route_enum.RouteEnum;
|
|
89
|
+
Object.defineProperty(exports, 'RpcRequestError', {
|
|
90
|
+
enumerable: true,
|
|
91
|
+
get: function () {
|
|
92
|
+
return lampamazaza_internal_utils.RpcRequestError;
|
|
93
|
+
}
|
|
94
|
+
});
|
|
95
|
+
Object.defineProperty(exports, 'TimeoutError', {
|
|
96
|
+
enumerable: true,
|
|
97
|
+
get: function () {
|
|
98
|
+
return lampamazaza_internal_utils.TimeoutError;
|
|
99
|
+
}
|
|
100
|
+
});
|
|
101
|
+
exports.TokenNotFoundInDestinationChainError = require_error$2.TokenNotFoundInDestinationChainError;
|
|
102
|
+
exports.TrustlineNotFoundError = require_errors.TrustlineNotFoundError;
|
|
103
|
+
exports.UnsupportedAssetIdError = require_errors.UnsupportedAssetIdError;
|
|
104
|
+
exports.UnsupportedDestinationMemoError = require_errors.UnsupportedDestinationMemoError;
|
|
105
|
+
Object.defineProperty(exports, 'VersionedNonceBuilder', {
|
|
106
|
+
enumerable: true,
|
|
107
|
+
get: function () {
|
|
108
|
+
return require_expirable_nonce.VersionedNonceBuilder;
|
|
109
|
+
}
|
|
110
|
+
});
|
|
111
|
+
exports.WithdrawalFailedError = require_withdrawal_watcher.WithdrawalFailedError;
|
|
112
|
+
exports.WithdrawalWatchError = require_withdrawal_watcher.WithdrawalWatchError;
|
|
113
|
+
exports.computeIntentHash = require_intent_hash.computeIntentHash;
|
|
114
|
+
exports.createDefaultRoute = require_route_config_factory.createDefaultRoute;
|
|
115
|
+
exports.createHotBridgeRoute = require_route_config_factory.createHotBridgeRoute;
|
|
116
|
+
exports.createIntentSignerNEP413 = require_factories.createIntentSignerNEP413;
|
|
117
|
+
exports.createIntentSignerNearKeyPair = require_factories.createIntentSignerNearKeyPair;
|
|
118
|
+
exports.createIntentSignerViem = require_factories.createIntentSignerViem;
|
|
119
|
+
exports.createInternalTransferRoute = require_route_config_factory.createInternalTransferRoute;
|
|
120
|
+
exports.createNearWithdrawalRoute = require_route_config_factory.createNearWithdrawalRoute;
|
|
121
|
+
exports.createOmniBridgeRoute = require_route_config_factory.createOmniBridgeRoute;
|
|
122
|
+
exports.createPoaBridgeRoute = require_route_config_factory.createPoaBridgeRoute;
|
|
123
|
+
exports.createVirtualChainRoute = require_route_config_factory.createVirtualChainRoute;
|
|
124
|
+
exports.validateAddressFormat = require_validateAddress.validateAddress;
|
package/dist/index.d.cts
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { BridgeNameEnum, BridgeNameEnumValues } from "./src/constants/bridge-name-enum.cjs";
|
|
2
|
+
import { RouteEnum, RouteEnumValues } from "./src/constants/route-enum.cjs";
|
|
3
|
+
import { VersionedNonceBuilder } from "./src/intents/expirable-nonce.cjs";
|
|
4
|
+
import { IntentPayload, IntentPayloadFactory, IntentPrimitive, IntentRelayParamsFactory, MultiPayload } from "./src/intents/shared-types.cjs";
|
|
5
|
+
import { IIntentSigner } from "./src/intents/interfaces/intent-signer.cjs";
|
|
6
|
+
import { OnBeforePublishIntentHook } from "./src/intents/intent-executer-impl/intent-executer.cjs";
|
|
7
|
+
import { Chain, Chains } from "./src/lib/caip2.cjs";
|
|
8
|
+
import { BatchWithdrawalResult, FeeEstimation, HotBridgeRouteConfig, IntentPublishResult, IntentSettlementStatus, InternalTransferRouteConfig, NearTxInfo, NearWithdrawalRouteConfig, OmniBridgeRouteConfig, ParsedAssetInfo, PoaBridgeRouteConfig, ProcessWithdrawalArgs, RouteConfig, SignAndSendArgs, SignAndSendWithdrawalArgs, SignedIntentsComposition, TxInfo, TxNoInfo, VirtualChainRouteConfig, WithdrawalIdentifier, WithdrawalParams, WithdrawalResult } from "./src/shared-types.cjs";
|
|
9
|
+
import { IntentPayloadBuilder } from "./src/intents/intent-payload-builder.cjs";
|
|
10
|
+
import { IntentsSDK, IntentsSDKConfig } from "./src/sdk.cjs";
|
|
11
|
+
import { createIntentSignerNEP413, createIntentSignerNearKeyPair, createIntentSignerViem } from "./src/intents/intent-signer-impl/factories.cjs";
|
|
12
|
+
import { createDefaultRoute, createHotBridgeRoute, createInternalTransferRoute, createNearWithdrawalRoute, createOmniBridgeRoute, createPoaBridgeRoute, createVirtualChainRoute } from "./src/lib/route-config-factory.cjs";
|
|
13
|
+
import { POA_TOKENS_ROUTABLE_THROUGH_OMNI_BRIDGE } from "./src/constants/poa-tokens-routable-through-omni-bridge.cjs";
|
|
14
|
+
import { WithdrawalFailedError, WithdrawalFailedErrorType, WithdrawalWatchError, WithdrawalWatchErrorType } from "./src/core/withdrawal-watcher.cjs";
|
|
15
|
+
import { FeeExceedsAmountError, FeeExceedsAmountErrorType, MinWithdrawalAmountError, MinWithdrawalAmountErrorType, TrustlineNotFoundError, TrustlineNotFoundErrorType, UnsupportedAssetIdError, UnsupportedAssetIdErrorType, UnsupportedDestinationMemoError, UnsupportedDestinationMemoErrorType } from "./src/classes/errors.cjs";
|
|
16
|
+
import { DestinationExplicitNearAccountDoesntExistError, DestinationExplicitNearAccountDoesntExistErrorType } from "./src/bridges/direct-bridge/error.cjs";
|
|
17
|
+
import { HotWithdrawalApiFeeRequestTimeoutError, HotWithdrawalApiFeeRequestTimeoutErrorType, HotWithdrawalNotFoundError, HotWithdrawalNotFoundErrorType } from "./src/bridges/hot-bridge/error.cjs";
|
|
18
|
+
import { InsufficientUtxoForOmniBridgeWithdrawalError, InsufficientUtxoForOmniBridgeWithdrawalErrorType, IntentsNearOmniAvailableBalanceTooLowError, IntentsNearOmniAvailableBalanceTooLowErrorType, InvalidFeeValueError, InvalidFeeValueErrorType, OmniWithdrawalApiFeeRequestTimeoutError, OmniWithdrawalApiFeeRequestTimeoutErrorType, TokenNotFoundInDestinationChainError, TokenNotFoundInDestinationChainErrorType } from "./src/bridges/omni-bridge/error.cjs";
|
|
19
|
+
import { computeIntentHash } from "./src/intents/intent-hash.cjs";
|
|
20
|
+
import { validateAddress } from "./src/lib/validateAddress.cjs";
|
|
21
|
+
import { AssertionError, AssertionErrorType, BaseError, BaseErrorType, EnvConfig, HttpRequestError, HttpRequestErrorType, ILogger, IntentSettlementError, IntentSettlementErrorType, NearIntentsEnv, PoaWithdrawalInvariantError, PoaWithdrawalInvariantErrorType, PoaWithdrawalNotFoundError, PoaWithdrawalNotFoundErrorType, PoaWithdrawalPendingError, PoaWithdrawalPendingErrorType, QuoteError, QuoteErrorType, RelayPublishError, RelayPublishErrorType, RetryOptions, RpcRequestError, RpcRequestErrorType, TimeoutError, TimeoutErrorType } from "lampamazaza-internal-utils";
|
|
22
|
+
export { AssertionError, type AssertionErrorType, BaseError, type BaseErrorType, type BatchWithdrawalResult, BridgeNameEnum, type BridgeNameEnumValues, type Chain, Chains, DestinationExplicitNearAccountDoesntExistError, type DestinationExplicitNearAccountDoesntExistErrorType, type EnvConfig, type FeeEstimation, FeeExceedsAmountError, type FeeExceedsAmountErrorType, type HotBridgeRouteConfig, HotWithdrawalApiFeeRequestTimeoutError, type HotWithdrawalApiFeeRequestTimeoutErrorType, HotWithdrawalNotFoundError, type HotWithdrawalNotFoundErrorType, HttpRequestError, type HttpRequestErrorType, type IIntentSigner, type ILogger, InsufficientUtxoForOmniBridgeWithdrawalError, type InsufficientUtxoForOmniBridgeWithdrawalErrorType, type IntentPayload, IntentPayloadBuilder, type IntentPayloadFactory, type IntentPrimitive, type IntentPublishResult, type IntentRelayParamsFactory, IntentSettlementError, type IntentSettlementErrorType, type IntentSettlementStatus, IntentsNearOmniAvailableBalanceTooLowError, type IntentsNearOmniAvailableBalanceTooLowErrorType, IntentsSDK, type IntentsSDKConfig, type InternalTransferRouteConfig, InvalidFeeValueError, type InvalidFeeValueErrorType, MinWithdrawalAmountError, type MinWithdrawalAmountErrorType, type MultiPayload, type NearIntentsEnv, type NearTxInfo, type NearWithdrawalRouteConfig, type OmniBridgeRouteConfig, OmniWithdrawalApiFeeRequestTimeoutError, type OmniWithdrawalApiFeeRequestTimeoutErrorType, type OnBeforePublishIntentHook, POA_TOKENS_ROUTABLE_THROUGH_OMNI_BRIDGE, type ParsedAssetInfo, type PoaBridgeRouteConfig, PoaWithdrawalInvariantError, type PoaWithdrawalInvariantErrorType, PoaWithdrawalNotFoundError, type PoaWithdrawalNotFoundErrorType, PoaWithdrawalPendingError, type PoaWithdrawalPendingErrorType, type ProcessWithdrawalArgs, QuoteError, type QuoteErrorType, RelayPublishError, type RelayPublishErrorType, type RetryOptions, type RouteConfig, RouteEnum, type RouteEnumValues, RpcRequestError, type RpcRequestErrorType, type SignAndSendArgs, type SignAndSendWithdrawalArgs, type SignedIntentsComposition, TimeoutError, type TimeoutErrorType, TokenNotFoundInDestinationChainError, type TokenNotFoundInDestinationChainErrorType, TrustlineNotFoundError, type TrustlineNotFoundErrorType, type TxInfo, type TxNoInfo, UnsupportedAssetIdError, type UnsupportedAssetIdErrorType, UnsupportedDestinationMemoError, type UnsupportedDestinationMemoErrorType, VersionedNonceBuilder, type VirtualChainRouteConfig, WithdrawalFailedError, type WithdrawalFailedErrorType, type WithdrawalIdentifier, type WithdrawalParams, type WithdrawalResult, WithdrawalWatchError, type WithdrawalWatchErrorType, computeIntentHash, createDefaultRoute, createHotBridgeRoute, createIntentSignerNEP413, createIntentSignerNearKeyPair, createIntentSignerViem, createInternalTransferRoute, createNearWithdrawalRoute, createOmniBridgeRoute, createPoaBridgeRoute, createVirtualChainRoute, validateAddress as validateAddressFormat };
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { BridgeNameEnum, BridgeNameEnumValues } from "./src/constants/bridge-name-enum.js";
|
|
2
|
+
import { RouteEnum, RouteEnumValues } from "./src/constants/route-enum.js";
|
|
3
|
+
import { VersionedNonceBuilder } from "./src/intents/expirable-nonce.js";
|
|
4
|
+
import { IntentPayload, IntentPayloadFactory, IntentPrimitive, IntentRelayParamsFactory, MultiPayload } from "./src/intents/shared-types.js";
|
|
5
|
+
import { IIntentSigner } from "./src/intents/interfaces/intent-signer.js";
|
|
6
|
+
import { OnBeforePublishIntentHook } from "./src/intents/intent-executer-impl/intent-executer.js";
|
|
7
|
+
import { Chain, Chains } from "./src/lib/caip2.js";
|
|
8
|
+
import { BatchWithdrawalResult, FeeEstimation, HotBridgeRouteConfig, IntentPublishResult, IntentSettlementStatus, InternalTransferRouteConfig, NearTxInfo, NearWithdrawalRouteConfig, OmniBridgeRouteConfig, ParsedAssetInfo, PoaBridgeRouteConfig, ProcessWithdrawalArgs, RouteConfig, SignAndSendArgs, SignAndSendWithdrawalArgs, SignedIntentsComposition, TxInfo, TxNoInfo, VirtualChainRouteConfig, WithdrawalIdentifier, WithdrawalParams, WithdrawalResult } from "./src/shared-types.js";
|
|
9
|
+
import { IntentPayloadBuilder } from "./src/intents/intent-payload-builder.js";
|
|
10
|
+
import { IntentsSDK, IntentsSDKConfig } from "./src/sdk.js";
|
|
11
|
+
import { createIntentSignerNEP413, createIntentSignerNearKeyPair, createIntentSignerViem } from "./src/intents/intent-signer-impl/factories.js";
|
|
12
|
+
import { createDefaultRoute, createHotBridgeRoute, createInternalTransferRoute, createNearWithdrawalRoute, createOmniBridgeRoute, createPoaBridgeRoute, createVirtualChainRoute } from "./src/lib/route-config-factory.js";
|
|
13
|
+
import { POA_TOKENS_ROUTABLE_THROUGH_OMNI_BRIDGE } from "./src/constants/poa-tokens-routable-through-omni-bridge.js";
|
|
14
|
+
import { WithdrawalFailedError, WithdrawalFailedErrorType, WithdrawalWatchError, WithdrawalWatchErrorType } from "./src/core/withdrawal-watcher.js";
|
|
15
|
+
import { FeeExceedsAmountError, FeeExceedsAmountErrorType, MinWithdrawalAmountError, MinWithdrawalAmountErrorType, TrustlineNotFoundError, TrustlineNotFoundErrorType, UnsupportedAssetIdError, UnsupportedAssetIdErrorType, UnsupportedDestinationMemoError, UnsupportedDestinationMemoErrorType } from "./src/classes/errors.js";
|
|
16
|
+
import { DestinationExplicitNearAccountDoesntExistError, DestinationExplicitNearAccountDoesntExistErrorType } from "./src/bridges/direct-bridge/error.js";
|
|
17
|
+
import { HotWithdrawalApiFeeRequestTimeoutError, HotWithdrawalApiFeeRequestTimeoutErrorType, HotWithdrawalNotFoundError, HotWithdrawalNotFoundErrorType } from "./src/bridges/hot-bridge/error.js";
|
|
18
|
+
import { InsufficientUtxoForOmniBridgeWithdrawalError, InsufficientUtxoForOmniBridgeWithdrawalErrorType, IntentsNearOmniAvailableBalanceTooLowError, IntentsNearOmniAvailableBalanceTooLowErrorType, InvalidFeeValueError, InvalidFeeValueErrorType, OmniWithdrawalApiFeeRequestTimeoutError, OmniWithdrawalApiFeeRequestTimeoutErrorType, TokenNotFoundInDestinationChainError, TokenNotFoundInDestinationChainErrorType } from "./src/bridges/omni-bridge/error.js";
|
|
19
|
+
import { computeIntentHash } from "./src/intents/intent-hash.js";
|
|
20
|
+
import { validateAddress } from "./src/lib/validateAddress.js";
|
|
21
|
+
import { AssertionError, AssertionErrorType, BaseError, BaseErrorType, EnvConfig, HttpRequestError, HttpRequestErrorType, ILogger, IntentSettlementError, IntentSettlementErrorType, NearIntentsEnv, PoaWithdrawalInvariantError, PoaWithdrawalInvariantErrorType, PoaWithdrawalNotFoundError, PoaWithdrawalNotFoundErrorType, PoaWithdrawalPendingError, PoaWithdrawalPendingErrorType, QuoteError, QuoteErrorType, RelayPublishError, RelayPublishErrorType, RetryOptions, RpcRequestError, RpcRequestErrorType, TimeoutError, TimeoutErrorType } from "lampamazaza-internal-utils";
|
|
22
|
+
export { AssertionError, type AssertionErrorType, BaseError, type BaseErrorType, type BatchWithdrawalResult, BridgeNameEnum, type BridgeNameEnumValues, type Chain, Chains, DestinationExplicitNearAccountDoesntExistError, type DestinationExplicitNearAccountDoesntExistErrorType, type EnvConfig, type FeeEstimation, FeeExceedsAmountError, type FeeExceedsAmountErrorType, type HotBridgeRouteConfig, HotWithdrawalApiFeeRequestTimeoutError, type HotWithdrawalApiFeeRequestTimeoutErrorType, HotWithdrawalNotFoundError, type HotWithdrawalNotFoundErrorType, HttpRequestError, type HttpRequestErrorType, type IIntentSigner, type ILogger, InsufficientUtxoForOmniBridgeWithdrawalError, type InsufficientUtxoForOmniBridgeWithdrawalErrorType, type IntentPayload, IntentPayloadBuilder, type IntentPayloadFactory, type IntentPrimitive, type IntentPublishResult, type IntentRelayParamsFactory, IntentSettlementError, type IntentSettlementErrorType, type IntentSettlementStatus, IntentsNearOmniAvailableBalanceTooLowError, type IntentsNearOmniAvailableBalanceTooLowErrorType, IntentsSDK, type IntentsSDKConfig, type InternalTransferRouteConfig, InvalidFeeValueError, type InvalidFeeValueErrorType, MinWithdrawalAmountError, type MinWithdrawalAmountErrorType, type MultiPayload, type NearIntentsEnv, type NearTxInfo, type NearWithdrawalRouteConfig, type OmniBridgeRouteConfig, OmniWithdrawalApiFeeRequestTimeoutError, type OmniWithdrawalApiFeeRequestTimeoutErrorType, type OnBeforePublishIntentHook, POA_TOKENS_ROUTABLE_THROUGH_OMNI_BRIDGE, type ParsedAssetInfo, type PoaBridgeRouteConfig, PoaWithdrawalInvariantError, type PoaWithdrawalInvariantErrorType, PoaWithdrawalNotFoundError, type PoaWithdrawalNotFoundErrorType, PoaWithdrawalPendingError, type PoaWithdrawalPendingErrorType, type ProcessWithdrawalArgs, QuoteError, type QuoteErrorType, RelayPublishError, type RelayPublishErrorType, type RetryOptions, type RouteConfig, RouteEnum, type RouteEnumValues, RpcRequestError, type RpcRequestErrorType, type SignAndSendArgs, type SignAndSendWithdrawalArgs, type SignedIntentsComposition, TimeoutError, type TimeoutErrorType, TokenNotFoundInDestinationChainError, type TokenNotFoundInDestinationChainErrorType, TrustlineNotFoundError, type TrustlineNotFoundErrorType, type TxInfo, type TxNoInfo, UnsupportedAssetIdError, type UnsupportedAssetIdErrorType, UnsupportedDestinationMemoError, type UnsupportedDestinationMemoErrorType, VersionedNonceBuilder, type VirtualChainRouteConfig, WithdrawalFailedError, type WithdrawalFailedErrorType, type WithdrawalIdentifier, type WithdrawalParams, type WithdrawalResult, WithdrawalWatchError, type WithdrawalWatchErrorType, computeIntentHash, createDefaultRoute, createHotBridgeRoute, createIntentSignerNEP413, createIntentSignerNearKeyPair, createIntentSignerViem, createInternalTransferRoute, createNearWithdrawalRoute, createOmniBridgeRoute, createPoaBridgeRoute, createVirtualChainRoute, validateAddress as validateAddressFormat };
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { FeeExceedsAmountError, MinWithdrawalAmountError, TrustlineNotFoundError, UnsupportedAssetIdError, UnsupportedDestinationMemoError } from "./src/classes/errors.js";
|
|
2
|
+
import { RouteEnum } from "./src/constants/route-enum.js";
|
|
3
|
+
import { Chains } from "./src/lib/caip2.js";
|
|
4
|
+
import { validateAddress } from "./src/lib/validateAddress.js";
|
|
5
|
+
import { BridgeNameEnum } from "./src/constants/bridge-name-enum.js";
|
|
6
|
+
import { DestinationExplicitNearAccountDoesntExistError } from "./src/bridges/direct-bridge/error.js";
|
|
7
|
+
import { HotWithdrawalApiFeeRequestTimeoutError, HotWithdrawalNotFoundError } from "./src/bridges/hot-bridge/error.js";
|
|
8
|
+
import { InsufficientUtxoForOmniBridgeWithdrawalError, IntentsNearOmniAvailableBalanceTooLowError, InvalidFeeValueError, OmniWithdrawalApiFeeRequestTimeoutError, TokenNotFoundInDestinationChainError } from "./src/bridges/omni-bridge/error.js";
|
|
9
|
+
import { POA_TOKENS_ROUTABLE_THROUGH_OMNI_BRIDGE } from "./src/constants/poa-tokens-routable-through-omni-bridge.js";
|
|
10
|
+
import { computeIntentHash } from "./src/intents/intent-hash.js";
|
|
11
|
+
import { VersionedNonceBuilder } from "./src/intents/expirable-nonce.js";
|
|
12
|
+
import { WithdrawalFailedError, WithdrawalWatchError } from "./src/core/withdrawal-watcher.js";
|
|
13
|
+
import { IntentPayloadBuilder } from "./src/intents/intent-payload-builder.js";
|
|
14
|
+
import { IntentsSDK } from "./src/sdk.js";
|
|
15
|
+
import { createIntentSignerNEP413, createIntentSignerNearKeyPair, createIntentSignerViem } from "./src/intents/intent-signer-impl/factories.js";
|
|
16
|
+
import { createDefaultRoute, createHotBridgeRoute, createInternalTransferRoute, createNearWithdrawalRoute, createOmniBridgeRoute, createPoaBridgeRoute, createVirtualChainRoute } from "./src/lib/route-config-factory.js";
|
|
17
|
+
import { AssertionError, BaseError, HttpRequestError, IntentSettlementError, PoaWithdrawalInvariantError, PoaWithdrawalNotFoundError, PoaWithdrawalPendingError, QuoteError, RelayPublishError, RpcRequestError, TimeoutError } from "lampamazaza-internal-utils";
|
|
18
|
+
|
|
19
|
+
export { AssertionError, BaseError, BridgeNameEnum, Chains, DestinationExplicitNearAccountDoesntExistError, FeeExceedsAmountError, HotWithdrawalApiFeeRequestTimeoutError, HotWithdrawalNotFoundError, HttpRequestError, InsufficientUtxoForOmniBridgeWithdrawalError, IntentPayloadBuilder, IntentSettlementError, IntentsNearOmniAvailableBalanceTooLowError, IntentsSDK, InvalidFeeValueError, MinWithdrawalAmountError, OmniWithdrawalApiFeeRequestTimeoutError, POA_TOKENS_ROUTABLE_THROUGH_OMNI_BRIDGE, PoaWithdrawalInvariantError, PoaWithdrawalNotFoundError, PoaWithdrawalPendingError, QuoteError, RelayPublishError, RouteEnum, RpcRequestError, TimeoutError, TokenNotFoundInDestinationChainError, TrustlineNotFoundError, UnsupportedAssetIdError, UnsupportedDestinationMemoError, VersionedNonceBuilder, WithdrawalFailedError, WithdrawalWatchError, computeIntentHash, createDefaultRoute, createHotBridgeRoute, createIntentSignerNEP413, createIntentSignerNearKeyPair, createIntentSignerViem, createInternalTransferRoute, createNearWithdrawalRoute, createOmniBridgeRoute, createPoaBridgeRoute, createVirtualChainRoute, validateAddress as validateAddressFormat };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
|
|
2
|
+
//#region src/bridges/aurora-engine-bridge/aurora-engine-bridge-constants.ts
|
|
3
|
+
const NEAR_NATIVE_ASSET_ID = "nep141:wrap.near";
|
|
4
|
+
const MIN_GAS_AMOUNT = "38500000000000";
|
|
5
|
+
const MIN_GAS_AMOUNT_NON_STANDARD_DECIMALS = "100000000000000";
|
|
6
|
+
|
|
7
|
+
//#endregion
|
|
8
|
+
exports.MIN_GAS_AMOUNT = MIN_GAS_AMOUNT;
|
|
9
|
+
exports.MIN_GAS_AMOUNT_NON_STANDARD_DECIMALS = MIN_GAS_AMOUNT_NON_STANDARD_DECIMALS;
|
|
10
|
+
exports.NEAR_NATIVE_ASSET_ID = NEAR_NATIVE_ASSET_ID;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
//#region src/bridges/aurora-engine-bridge/aurora-engine-bridge-constants.ts
|
|
2
|
+
const NEAR_NATIVE_ASSET_ID = "nep141:wrap.near";
|
|
3
|
+
const MIN_GAS_AMOUNT = "38500000000000";
|
|
4
|
+
const MIN_GAS_AMOUNT_NON_STANDARD_DECIMALS = "100000000000000";
|
|
5
|
+
|
|
6
|
+
//#endregion
|
|
7
|
+
export { MIN_GAS_AMOUNT, MIN_GAS_AMOUNT_NON_STANDARD_DECIMALS, NEAR_NATIVE_ASSET_ID };
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
const require_rolldown_runtime = require('../../../_virtual/rolldown_runtime.cjs');
|
|
2
|
+
const require_route_enum = require('../../constants/route-enum.cjs');
|
|
3
|
+
const require_aurora_engine_bridge_constants = require('./aurora-engine-bridge-constants.cjs');
|
|
4
|
+
let lampamazaza_internal_utils = require("lampamazaza-internal-utils");
|
|
5
|
+
let viem = require("viem");
|
|
6
|
+
|
|
7
|
+
//#region src/bridges/aurora-engine-bridge/aurora-engine-bridge-utils.ts
|
|
8
|
+
function createWithdrawIntentPrimitive(params) {
|
|
9
|
+
const { contractId: tokenAccountId, standard } = lampamazaza_internal_utils.utils.parseDefuseAssetId(params.assetId);
|
|
10
|
+
(0, lampamazaza_internal_utils.assert)(standard === "nep141", "Only NEP-141 is supported");
|
|
11
|
+
if (params.proxyTokenContractId == null) return {
|
|
12
|
+
intent: "ft_withdraw",
|
|
13
|
+
token: tokenAccountId,
|
|
14
|
+
receiver_id: params.auroraEngineContractId,
|
|
15
|
+
amount: params.amount.toString(),
|
|
16
|
+
msg: makeAuroraEngineDepositMsg(params.destinationAddress),
|
|
17
|
+
storage_deposit: params.storageDeposit > 0n ? params.storageDeposit.toString() : void 0,
|
|
18
|
+
min_gas: require_aurora_engine_bridge_constants.MIN_GAS_AMOUNT
|
|
19
|
+
};
|
|
20
|
+
return {
|
|
21
|
+
intent: "ft_withdraw",
|
|
22
|
+
token: tokenAccountId,
|
|
23
|
+
receiver_id: params.proxyTokenContractId,
|
|
24
|
+
amount: params.amount.toString(),
|
|
25
|
+
msg: `${params.auroraEngineContractId}:${makeAuroraEngineDepositMsg(params.destinationAddress)}`,
|
|
26
|
+
storage_deposit: params.storageDeposit > 0n ? params.storageDeposit.toString() : void 0,
|
|
27
|
+
min_gas: require_aurora_engine_bridge_constants.MIN_GAS_AMOUNT_NON_STANDARD_DECIMALS
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* To deposit to AuroraEngine powered chain, we need to have a `msg`
|
|
32
|
+
* with the destination address in a special format (lower case + without 0x).
|
|
33
|
+
*/
|
|
34
|
+
function makeAuroraEngineDepositMsg(recipientAddress) {
|
|
35
|
+
return (0, viem.getAddress)(recipientAddress).slice(2).toLowerCase();
|
|
36
|
+
}
|
|
37
|
+
function withdrawalParamsInvariant(params) {
|
|
38
|
+
(0, lampamazaza_internal_utils.assert)(params.routeConfig != null, "Bridge config is required");
|
|
39
|
+
(0, lampamazaza_internal_utils.assert)(params.routeConfig.route === require_route_enum.RouteEnum.VirtualChain, "Bridge is not aurora_engine");
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
//#endregion
|
|
43
|
+
exports.createWithdrawIntentPrimitive = createWithdrawIntentPrimitive;
|
|
44
|
+
exports.withdrawalParamsInvariant = withdrawalParamsInvariant;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { RouteEnum } from "../../constants/route-enum.js";
|
|
2
|
+
import { MIN_GAS_AMOUNT, MIN_GAS_AMOUNT_NON_STANDARD_DECIMALS } from "./aurora-engine-bridge-constants.js";
|
|
3
|
+
import { assert, utils } from "lampamazaza-internal-utils";
|
|
4
|
+
import { getAddress } from "viem";
|
|
5
|
+
|
|
6
|
+
//#region src/bridges/aurora-engine-bridge/aurora-engine-bridge-utils.ts
|
|
7
|
+
function createWithdrawIntentPrimitive(params) {
|
|
8
|
+
const { contractId: tokenAccountId, standard } = utils.parseDefuseAssetId(params.assetId);
|
|
9
|
+
assert(standard === "nep141", "Only NEP-141 is supported");
|
|
10
|
+
if (params.proxyTokenContractId == null) return {
|
|
11
|
+
intent: "ft_withdraw",
|
|
12
|
+
token: tokenAccountId,
|
|
13
|
+
receiver_id: params.auroraEngineContractId,
|
|
14
|
+
amount: params.amount.toString(),
|
|
15
|
+
msg: makeAuroraEngineDepositMsg(params.destinationAddress),
|
|
16
|
+
storage_deposit: params.storageDeposit > 0n ? params.storageDeposit.toString() : void 0,
|
|
17
|
+
min_gas: MIN_GAS_AMOUNT
|
|
18
|
+
};
|
|
19
|
+
return {
|
|
20
|
+
intent: "ft_withdraw",
|
|
21
|
+
token: tokenAccountId,
|
|
22
|
+
receiver_id: params.proxyTokenContractId,
|
|
23
|
+
amount: params.amount.toString(),
|
|
24
|
+
msg: `${params.auroraEngineContractId}:${makeAuroraEngineDepositMsg(params.destinationAddress)}`,
|
|
25
|
+
storage_deposit: params.storageDeposit > 0n ? params.storageDeposit.toString() : void 0,
|
|
26
|
+
min_gas: MIN_GAS_AMOUNT_NON_STANDARD_DECIMALS
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* To deposit to AuroraEngine powered chain, we need to have a `msg`
|
|
31
|
+
* with the destination address in a special format (lower case + without 0x).
|
|
32
|
+
*/
|
|
33
|
+
function makeAuroraEngineDepositMsg(recipientAddress) {
|
|
34
|
+
return getAddress(recipientAddress).slice(2).toLowerCase();
|
|
35
|
+
}
|
|
36
|
+
function withdrawalParamsInvariant(params) {
|
|
37
|
+
assert(params.routeConfig != null, "Bridge config is required");
|
|
38
|
+
assert(params.routeConfig.route === RouteEnum.VirtualChain, "Bridge is not aurora_engine");
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
//#endregion
|
|
42
|
+
export { createWithdrawIntentPrimitive, withdrawalParamsInvariant };
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
const require_rolldown_runtime = require('../../../_virtual/rolldown_runtime.cjs');
|
|
2
|
+
const require_errors = require('../../classes/errors.cjs');
|
|
3
|
+
const require_route_enum = require('../../constants/route-enum.cjs');
|
|
4
|
+
const require_caip2 = require('../../lib/caip2.cjs');
|
|
5
|
+
const require_estimate_fee = require('../../lib/estimate-fee.cjs');
|
|
6
|
+
const require_parse_defuse_asset_id = require('../../lib/parse-defuse-asset-id.cjs');
|
|
7
|
+
const require_validateAddress = require('../../lib/validateAddress.cjs');
|
|
8
|
+
const require_aurora_engine_bridge_constants = require('./aurora-engine-bridge-constants.cjs');
|
|
9
|
+
const require_aurora_engine_bridge_utils = require('./aurora-engine-bridge-utils.cjs');
|
|
10
|
+
let lampamazaza_internal_utils = require("lampamazaza-internal-utils");
|
|
11
|
+
|
|
12
|
+
//#region src/bridges/aurora-engine-bridge/aurora-engine-bridge.ts
|
|
13
|
+
var AuroraEngineBridge = class {
|
|
14
|
+
constructor({ envConfig, nearProvider, solverRelayApiKey }) {
|
|
15
|
+
this.route = require_route_enum.RouteEnum.VirtualChain;
|
|
16
|
+
this.envConfig = envConfig;
|
|
17
|
+
this.nearProvider = nearProvider;
|
|
18
|
+
this.solverRelayApiKey = solverRelayApiKey;
|
|
19
|
+
}
|
|
20
|
+
is(routeConfig) {
|
|
21
|
+
return routeConfig.route === this.route;
|
|
22
|
+
}
|
|
23
|
+
async supports(params) {
|
|
24
|
+
if (params.routeConfig == null || !this.is(params.routeConfig)) return false;
|
|
25
|
+
const isValid = require_parse_defuse_asset_id.parseDefuseAssetId(params.assetId).standard === "nep141";
|
|
26
|
+
if (!isValid) throw new require_errors.UnsupportedAssetIdError(params.assetId, "`assetId` does not match `routeConfig`.");
|
|
27
|
+
return isValid;
|
|
28
|
+
}
|
|
29
|
+
parseAssetId() {
|
|
30
|
+
return null;
|
|
31
|
+
}
|
|
32
|
+
createWithdrawalIntents(args) {
|
|
33
|
+
require_aurora_engine_bridge_utils.withdrawalParamsInvariant(args.withdrawalParams);
|
|
34
|
+
const intents = [];
|
|
35
|
+
if (args.feeEstimation.quote != null) intents.push({
|
|
36
|
+
intent: "token_diff",
|
|
37
|
+
diff: {
|
|
38
|
+
[args.feeEstimation.quote.defuse_asset_identifier_in]: `-${args.feeEstimation.quote.amount_in}`,
|
|
39
|
+
[args.feeEstimation.quote.defuse_asset_identifier_out]: args.feeEstimation.quote.amount_out
|
|
40
|
+
},
|
|
41
|
+
referral: args.referral
|
|
42
|
+
});
|
|
43
|
+
const intent = require_aurora_engine_bridge_utils.createWithdrawIntentPrimitive({
|
|
44
|
+
assetId: args.withdrawalParams.assetId,
|
|
45
|
+
auroraEngineContractId: args.withdrawalParams.routeConfig.auroraEngineContractId,
|
|
46
|
+
proxyTokenContractId: args.withdrawalParams.routeConfig.proxyTokenContractId,
|
|
47
|
+
destinationAddress: args.withdrawalParams.destinationAddress,
|
|
48
|
+
amount: args.withdrawalParams.amount,
|
|
49
|
+
storageDeposit: require_estimate_fee.getUnderlyingFee(args.feeEstimation, require_route_enum.RouteEnum.VirtualChain, "storageDepositFee")
|
|
50
|
+
});
|
|
51
|
+
intents.push(intent);
|
|
52
|
+
return Promise.resolve(intents);
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Aurora Engine bridge doesn't have withdrawal restrictions.
|
|
56
|
+
*/
|
|
57
|
+
async validateWithdrawal(args) {
|
|
58
|
+
if (require_validateAddress.validateAddress(args.destinationAddress, require_caip2.Chains.Ethereum) === false) throw new require_errors.InvalidDestinationAddressForWithdrawalError(args.destinationAddress, "virtual-chain");
|
|
59
|
+
}
|
|
60
|
+
async estimateWithdrawalFee(args) {
|
|
61
|
+
require_aurora_engine_bridge_utils.withdrawalParamsInvariant(args.withdrawalParams);
|
|
62
|
+
const { contractId: tokenAccountId, standard } = lampamazaza_internal_utils.utils.parseDefuseAssetId(args.withdrawalParams.assetId);
|
|
63
|
+
(0, lampamazaza_internal_utils.assert)(standard === "nep141", "Only NEP-141 is supported");
|
|
64
|
+
const [minStorageBalance, userStorageBalance] = await Promise.all([(0, lampamazaza_internal_utils.getNearNep141MinStorageBalance)({
|
|
65
|
+
contractId: tokenAccountId,
|
|
66
|
+
nearProvider: this.nearProvider
|
|
67
|
+
}), (0, lampamazaza_internal_utils.getNearNep141StorageBalance)({
|
|
68
|
+
contractId: tokenAccountId,
|
|
69
|
+
accountId: args.withdrawalParams.routeConfig.auroraEngineContractId,
|
|
70
|
+
nearProvider: this.nearProvider
|
|
71
|
+
})]);
|
|
72
|
+
if (minStorageBalance <= userStorageBalance) return {
|
|
73
|
+
amount: 0n,
|
|
74
|
+
quote: null,
|
|
75
|
+
underlyingFees: { [require_route_enum.RouteEnum.VirtualChain]: { storageDepositFee: 0n } }
|
|
76
|
+
};
|
|
77
|
+
const feeAssetId = require_aurora_engine_bridge_constants.NEAR_NATIVE_ASSET_ID;
|
|
78
|
+
const feeAmount = minStorageBalance - userStorageBalance;
|
|
79
|
+
const feeQuote = args.withdrawalParams.assetId === feeAssetId ? null : await require_estimate_fee.getFeeQuote({
|
|
80
|
+
feeAmount,
|
|
81
|
+
feeAssetId,
|
|
82
|
+
tokenAssetId: args.withdrawalParams.assetId,
|
|
83
|
+
logger: args.logger,
|
|
84
|
+
envConfig: this.envConfig,
|
|
85
|
+
quoteOptions: args.quoteOptions,
|
|
86
|
+
solverRelayApiKey: this.solverRelayApiKey
|
|
87
|
+
});
|
|
88
|
+
return {
|
|
89
|
+
amount: feeQuote ? BigInt(feeQuote.amount_in) : feeAmount,
|
|
90
|
+
quote: feeQuote,
|
|
91
|
+
underlyingFees: { [require_route_enum.RouteEnum.VirtualChain]: { storageDepositFee: feeAmount } }
|
|
92
|
+
};
|
|
93
|
+
}
|
|
94
|
+
createWithdrawalIdentifier(args) {
|
|
95
|
+
return {
|
|
96
|
+
landingChain: require_caip2.Chains.Near,
|
|
97
|
+
index: args.index,
|
|
98
|
+
withdrawalParams: args.withdrawalParams,
|
|
99
|
+
tx: args.tx
|
|
100
|
+
};
|
|
101
|
+
}
|
|
102
|
+
async describeWithdrawal() {
|
|
103
|
+
return {
|
|
104
|
+
status: "completed",
|
|
105
|
+
txHash: null
|
|
106
|
+
};
|
|
107
|
+
}
|
|
108
|
+
};
|
|
109
|
+
|
|
110
|
+
//#endregion
|
|
111
|
+
exports.AuroraEngineBridge = AuroraEngineBridge;
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
import { InvalidDestinationAddressForWithdrawalError, UnsupportedAssetIdError } from "../../classes/errors.js";
|
|
2
|
+
import { RouteEnum } from "../../constants/route-enum.js";
|
|
3
|
+
import { Chains } from "../../lib/caip2.js";
|
|
4
|
+
import { getFeeQuote, getUnderlyingFee } from "../../lib/estimate-fee.js";
|
|
5
|
+
import { parseDefuseAssetId } from "../../lib/parse-defuse-asset-id.js";
|
|
6
|
+
import { validateAddress } from "../../lib/validateAddress.js";
|
|
7
|
+
import { NEAR_NATIVE_ASSET_ID } from "./aurora-engine-bridge-constants.js";
|
|
8
|
+
import { createWithdrawIntentPrimitive, withdrawalParamsInvariant } from "./aurora-engine-bridge-utils.js";
|
|
9
|
+
import { assert, getNearNep141MinStorageBalance, getNearNep141StorageBalance, utils } from "lampamazaza-internal-utils";
|
|
10
|
+
|
|
11
|
+
//#region src/bridges/aurora-engine-bridge/aurora-engine-bridge.ts
|
|
12
|
+
var AuroraEngineBridge = class {
|
|
13
|
+
constructor({ envConfig, nearProvider, solverRelayApiKey }) {
|
|
14
|
+
this.route = RouteEnum.VirtualChain;
|
|
15
|
+
this.envConfig = envConfig;
|
|
16
|
+
this.nearProvider = nearProvider;
|
|
17
|
+
this.solverRelayApiKey = solverRelayApiKey;
|
|
18
|
+
}
|
|
19
|
+
is(routeConfig) {
|
|
20
|
+
return routeConfig.route === this.route;
|
|
21
|
+
}
|
|
22
|
+
async supports(params) {
|
|
23
|
+
if (params.routeConfig == null || !this.is(params.routeConfig)) return false;
|
|
24
|
+
const isValid = parseDefuseAssetId(params.assetId).standard === "nep141";
|
|
25
|
+
if (!isValid) throw new UnsupportedAssetIdError(params.assetId, "`assetId` does not match `routeConfig`.");
|
|
26
|
+
return isValid;
|
|
27
|
+
}
|
|
28
|
+
parseAssetId() {
|
|
29
|
+
return null;
|
|
30
|
+
}
|
|
31
|
+
createWithdrawalIntents(args) {
|
|
32
|
+
withdrawalParamsInvariant(args.withdrawalParams);
|
|
33
|
+
const intents = [];
|
|
34
|
+
if (args.feeEstimation.quote != null) intents.push({
|
|
35
|
+
intent: "token_diff",
|
|
36
|
+
diff: {
|
|
37
|
+
[args.feeEstimation.quote.defuse_asset_identifier_in]: `-${args.feeEstimation.quote.amount_in}`,
|
|
38
|
+
[args.feeEstimation.quote.defuse_asset_identifier_out]: args.feeEstimation.quote.amount_out
|
|
39
|
+
},
|
|
40
|
+
referral: args.referral
|
|
41
|
+
});
|
|
42
|
+
const intent = createWithdrawIntentPrimitive({
|
|
43
|
+
assetId: args.withdrawalParams.assetId,
|
|
44
|
+
auroraEngineContractId: args.withdrawalParams.routeConfig.auroraEngineContractId,
|
|
45
|
+
proxyTokenContractId: args.withdrawalParams.routeConfig.proxyTokenContractId,
|
|
46
|
+
destinationAddress: args.withdrawalParams.destinationAddress,
|
|
47
|
+
amount: args.withdrawalParams.amount,
|
|
48
|
+
storageDeposit: getUnderlyingFee(args.feeEstimation, RouteEnum.VirtualChain, "storageDepositFee")
|
|
49
|
+
});
|
|
50
|
+
intents.push(intent);
|
|
51
|
+
return Promise.resolve(intents);
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Aurora Engine bridge doesn't have withdrawal restrictions.
|
|
55
|
+
*/
|
|
56
|
+
async validateWithdrawal(args) {
|
|
57
|
+
if (validateAddress(args.destinationAddress, Chains.Ethereum) === false) throw new InvalidDestinationAddressForWithdrawalError(args.destinationAddress, "virtual-chain");
|
|
58
|
+
}
|
|
59
|
+
async estimateWithdrawalFee(args) {
|
|
60
|
+
withdrawalParamsInvariant(args.withdrawalParams);
|
|
61
|
+
const { contractId: tokenAccountId, standard } = utils.parseDefuseAssetId(args.withdrawalParams.assetId);
|
|
62
|
+
assert(standard === "nep141", "Only NEP-141 is supported");
|
|
63
|
+
const [minStorageBalance, userStorageBalance] = await Promise.all([getNearNep141MinStorageBalance({
|
|
64
|
+
contractId: tokenAccountId,
|
|
65
|
+
nearProvider: this.nearProvider
|
|
66
|
+
}), getNearNep141StorageBalance({
|
|
67
|
+
contractId: tokenAccountId,
|
|
68
|
+
accountId: args.withdrawalParams.routeConfig.auroraEngineContractId,
|
|
69
|
+
nearProvider: this.nearProvider
|
|
70
|
+
})]);
|
|
71
|
+
if (minStorageBalance <= userStorageBalance) return {
|
|
72
|
+
amount: 0n,
|
|
73
|
+
quote: null,
|
|
74
|
+
underlyingFees: { [RouteEnum.VirtualChain]: { storageDepositFee: 0n } }
|
|
75
|
+
};
|
|
76
|
+
const feeAssetId = NEAR_NATIVE_ASSET_ID;
|
|
77
|
+
const feeAmount = minStorageBalance - userStorageBalance;
|
|
78
|
+
const feeQuote = args.withdrawalParams.assetId === feeAssetId ? null : await getFeeQuote({
|
|
79
|
+
feeAmount,
|
|
80
|
+
feeAssetId,
|
|
81
|
+
tokenAssetId: args.withdrawalParams.assetId,
|
|
82
|
+
logger: args.logger,
|
|
83
|
+
envConfig: this.envConfig,
|
|
84
|
+
quoteOptions: args.quoteOptions,
|
|
85
|
+
solverRelayApiKey: this.solverRelayApiKey
|
|
86
|
+
});
|
|
87
|
+
return {
|
|
88
|
+
amount: feeQuote ? BigInt(feeQuote.amount_in) : feeAmount,
|
|
89
|
+
quote: feeQuote,
|
|
90
|
+
underlyingFees: { [RouteEnum.VirtualChain]: { storageDepositFee: feeAmount } }
|
|
91
|
+
};
|
|
92
|
+
}
|
|
93
|
+
createWithdrawalIdentifier(args) {
|
|
94
|
+
return {
|
|
95
|
+
landingChain: Chains.Near,
|
|
96
|
+
index: args.index,
|
|
97
|
+
withdrawalParams: args.withdrawalParams,
|
|
98
|
+
tx: args.tx
|
|
99
|
+
};
|
|
100
|
+
}
|
|
101
|
+
async describeWithdrawal() {
|
|
102
|
+
return {
|
|
103
|
+
status: "completed",
|
|
104
|
+
txHash: null
|
|
105
|
+
};
|
|
106
|
+
}
|
|
107
|
+
};
|
|
108
|
+
|
|
109
|
+
//#endregion
|
|
110
|
+
export { AuroraEngineBridge };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
|
|
2
|
+
//#region src/bridges/direct-bridge/direct-bridge-constants.ts
|
|
3
|
+
const NEAR_NATIVE_ASSET_ID = "nep141:wrap.near";
|
|
4
|
+
const MIN_GAS_AMOUNT = "17050000000000";
|
|
5
|
+
|
|
6
|
+
//#endregion
|
|
7
|
+
exports.MIN_GAS_AMOUNT = MIN_GAS_AMOUNT;
|
|
8
|
+
exports.NEAR_NATIVE_ASSET_ID = NEAR_NATIVE_ASSET_ID;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
const require_rolldown_runtime = require('../../../_virtual/rolldown_runtime.cjs');
|
|
2
|
+
const require_route_enum = require('../../constants/route-enum.cjs');
|
|
3
|
+
const require_direct_bridge_constants = require('./direct-bridge-constants.cjs');
|
|
4
|
+
let lampamazaza_internal_utils = require("lampamazaza-internal-utils");
|
|
5
|
+
let near_api_js = require("near-api-js");
|
|
6
|
+
|
|
7
|
+
//#region src/bridges/direct-bridge/direct-bridge-utils.ts
|
|
8
|
+
function createWithdrawIntentPrimitive(params) {
|
|
9
|
+
if (params.assetId === require_direct_bridge_constants.NEAR_NATIVE_ASSET_ID && params.msg === void 0) return {
|
|
10
|
+
intent: "native_withdraw",
|
|
11
|
+
receiver_id: params.destinationAddress,
|
|
12
|
+
amount: params.amount.toString()
|
|
13
|
+
};
|
|
14
|
+
const { contractId: tokenAccountId, standard } = lampamazaza_internal_utils.utils.parseDefuseAssetId(params.assetId);
|
|
15
|
+
(0, lampamazaza_internal_utils.assert)(standard === "nep141", "Only NEP-141 is supported");
|
|
16
|
+
if (params.msg !== void 0) params.logger?.warn("min_gas is not set for direct-bridge withdrawal with msg, gas consumption is unpredictable");
|
|
17
|
+
return {
|
|
18
|
+
intent: "ft_withdraw",
|
|
19
|
+
token: tokenAccountId,
|
|
20
|
+
receiver_id: params.destinationAddress,
|
|
21
|
+
amount: params.amount.toString(),
|
|
22
|
+
storage_deposit: params.storageDeposit > 0n ? params.storageDeposit.toString() : void 0,
|
|
23
|
+
msg: params.msg,
|
|
24
|
+
min_gas: params.msg == null ? require_direct_bridge_constants.MIN_GAS_AMOUNT : void 0
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
function withdrawalParamsInvariant(params) {
|
|
28
|
+
(0, lampamazaza_internal_utils.assert)(!params.routeConfig ? true : params.routeConfig.route === require_route_enum.RouteEnum.NearWithdrawal, "Bridge is not direct");
|
|
29
|
+
}
|
|
30
|
+
async function accountExistsInNEAR(provider, accountId) {
|
|
31
|
+
try {
|
|
32
|
+
await (0, lampamazaza_internal_utils.unwrapNearFailoverRpcProvider)(provider).query({
|
|
33
|
+
request_type: "view_account",
|
|
34
|
+
account_id: accountId,
|
|
35
|
+
finality: "final"
|
|
36
|
+
});
|
|
37
|
+
return true;
|
|
38
|
+
} catch (error) {
|
|
39
|
+
if (error instanceof near_api_js.providers.TypedError && error.type === "AccountDoesNotExist") return false;
|
|
40
|
+
throw error;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
//#endregion
|
|
45
|
+
exports.accountExistsInNEAR = accountExistsInNEAR;
|
|
46
|
+
exports.createWithdrawIntentPrimitive = createWithdrawIntentPrimitive;
|
|
47
|
+
exports.withdrawalParamsInvariant = withdrawalParamsInvariant;
|