amogus-sdk-internal-utils 0.35.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/_virtual/rolldown_runtime.cjs +43 -0
- package/dist/_virtual/rolldown_runtime.js +18 -0
- package/dist/bridgeIndexer/bridgeIndexerHttpClient/apis.cjs +10 -0
- package/dist/bridgeIndexer/bridgeIndexerHttpClient/apis.d.cts +6 -0
- package/dist/bridgeIndexer/bridgeIndexerHttpClient/apis.d.ts +6 -0
- package/dist/bridgeIndexer/bridgeIndexerHttpClient/apis.js +10 -0
- package/dist/bridgeIndexer/bridgeIndexerHttpClient/index.cjs +17 -0
- package/dist/bridgeIndexer/bridgeIndexerHttpClient/index.d.cts +9 -0
- package/dist/bridgeIndexer/bridgeIndexerHttpClient/index.d.ts +9 -0
- package/dist/bridgeIndexer/bridgeIndexerHttpClient/index.js +12 -0
- package/dist/bridgeIndexer/bridgeIndexerHttpClient/runtime.cjs +20 -0
- package/dist/bridgeIndexer/bridgeIndexerHttpClient/runtime.js +20 -0
- package/dist/bridgeIndexer/bridgeIndexerHttpClient/types.cjs +25 -0
- package/dist/bridgeIndexer/bridgeIndexerHttpClient/types.d.cts +31 -0
- package/dist/bridgeIndexer/bridgeIndexerHttpClient/types.d.ts +31 -0
- package/dist/bridgeIndexer/bridgeIndexerHttpClient/types.js +23 -0
- package/dist/bridgeIndexer/index.cjs +13 -0
- package/dist/bridgeIndexer/index.d.cts +8 -0
- package/dist/bridgeIndexer/index.d.ts +8 -0
- package/dist/bridgeIndexer/index.js +8 -0
- package/dist/config.cjs +86 -0
- package/dist/config.d.cts +50 -0
- package/dist/config.d.ts +50 -0
- package/dist/config.js +76 -0
- package/dist/errors/assert.cjs +11 -0
- package/dist/errors/assert.d.cts +11 -0
- package/dist/errors/assert.d.ts +11 -0
- package/dist/errors/assert.js +11 -0
- package/dist/errors/base.cjs +34 -0
- package/dist/errors/base.d.cts +21 -0
- package/dist/errors/base.d.ts +21 -0
- package/dist/errors/base.js +33 -0
- package/dist/errors/index.cjs +23 -0
- package/dist/errors/index.d.cts +11 -0
- package/dist/errors/index.d.ts +11 -0
- package/dist/errors/index.js +18 -0
- package/dist/errors/request.cjs +48 -0
- package/dist/errors/request.d.cts +61 -0
- package/dist/errors/request.d.ts +61 -0
- package/dist/errors/request.js +46 -0
- package/dist/errors/utils/isNetworkError.cjs +23 -0
- package/dist/errors/utils/isNetworkError.js +22 -0
- package/dist/errors/utils/toError.cjs +8 -0
- package/dist/errors/utils/toError.d.cts +4 -0
- package/dist/errors/utils/toError.d.ts +4 -0
- package/dist/errors/utils/toError.js +7 -0
- package/dist/index.cjs +144 -0
- package/dist/index.d.cts +33 -0
- package/dist/index.d.ts +33 -0
- package/dist/index.js +33 -0
- package/dist/logger.d.cts +11 -0
- package/dist/logger.d.ts +11 -0
- package/dist/nearClient.cjs +18 -0
- package/dist/nearClient.d.cts +8 -0
- package/dist/nearClient.d.ts +8 -0
- package/dist/nearClient.js +18 -0
- package/dist/poaBridge/constants/blockchains.cjs +62 -0
- package/dist/poaBridge/constants/blockchains.d.cts +95 -0
- package/dist/poaBridge/constants/blockchains.d.ts +95 -0
- package/dist/poaBridge/constants/blockchains.js +59 -0
- package/dist/poaBridge/errors/withdrawal.cjs +52 -0
- package/dist/poaBridge/errors/withdrawal.d.cts +34 -0
- package/dist/poaBridge/errors/withdrawal.d.ts +34 -0
- package/dist/poaBridge/errors/withdrawal.js +50 -0
- package/dist/poaBridge/getPendingDeposits.cjs +31 -0
- package/dist/poaBridge/getPendingDeposits.d.cts +14 -0
- package/dist/poaBridge/getPendingDeposits.d.ts +15 -0
- package/dist/poaBridge/getPendingDeposits.js +31 -0
- package/dist/poaBridge/index.cjs +23 -0
- package/dist/poaBridge/index.d.cts +11 -0
- package/dist/poaBridge/index.d.ts +11 -0
- package/dist/poaBridge/index.js +18 -0
- package/dist/poaBridge/poaBridgeHttpClient/apis.cjs +38 -0
- package/dist/poaBridge/poaBridgeHttpClient/apis.d.cts +12 -0
- package/dist/poaBridge/poaBridgeHttpClient/apis.d.ts +12 -0
- package/dist/poaBridge/poaBridgeHttpClient/apis.js +32 -0
- package/dist/poaBridge/poaBridgeHttpClient/index.cjs +21 -0
- package/dist/poaBridge/poaBridgeHttpClient/index.d.cts +9 -0
- package/dist/poaBridge/poaBridgeHttpClient/index.d.ts +9 -0
- package/dist/poaBridge/poaBridgeHttpClient/index.js +16 -0
- package/dist/poaBridge/poaBridgeHttpClient/runtime.cjs +49 -0
- package/dist/poaBridge/poaBridgeHttpClient/runtime.js +47 -0
- package/dist/poaBridge/poaBridgeHttpClient/types.d.cts +172 -0
- package/dist/poaBridge/poaBridgeHttpClient/types.d.ts +172 -0
- package/dist/poaBridge/waitForWithdrawalCompletion.cjs +57 -0
- package/dist/poaBridge/waitForWithdrawalCompletion.d.cts +31 -0
- package/dist/poaBridge/waitForWithdrawalCompletion.d.ts +31 -0
- package/dist/poaBridge/waitForWithdrawalCompletion.js +56 -0
- package/dist/services/blockchainBalanceService.cjs +40 -0
- package/dist/services/blockchainBalanceService.d.cts +21 -0
- package/dist/services/blockchainBalanceService.d.ts +21 -0
- package/dist/services/blockchainBalanceService.js +37 -0
- package/dist/solverRelay/errors/intentSettlement.cjs +20 -0
- package/dist/solverRelay/errors/intentSettlement.d.cts +13 -0
- package/dist/solverRelay/errors/intentSettlement.d.ts +13 -0
- package/dist/solverRelay/errors/intentSettlement.js +20 -0
- package/dist/solverRelay/errors/quote.cjs +18 -0
- package/dist/solverRelay/errors/quote.d.cts +21 -0
- package/dist/solverRelay/errors/quote.d.ts +22 -0
- package/dist/solverRelay/errors/quote.js +18 -0
- package/dist/solverRelay/getQuote.cjs +70 -0
- package/dist/solverRelay/getQuote.d.cts +14 -0
- package/dist/solverRelay/getQuote.d.ts +14 -0
- package/dist/solverRelay/getQuote.js +70 -0
- package/dist/solverRelay/getStatus.cjs +26 -0
- package/dist/solverRelay/getStatus.d.cts +17 -0
- package/dist/solverRelay/getStatus.d.ts +18 -0
- package/dist/solverRelay/getStatus.js +26 -0
- package/dist/solverRelay/index.cjs +27 -0
- package/dist/solverRelay/index.d.cts +16 -0
- package/dist/solverRelay/index.d.ts +16 -0
- package/dist/solverRelay/index.js +22 -0
- package/dist/solverRelay/publishIntent.cjs +20 -0
- package/dist/solverRelay/publishIntent.d.cts +15 -0
- package/dist/solverRelay/publishIntent.d.ts +16 -0
- package/dist/solverRelay/publishIntent.js +20 -0
- package/dist/solverRelay/publishIntents.cjs +42 -0
- package/dist/solverRelay/publishIntents.d.cts +10 -0
- package/dist/solverRelay/publishIntents.d.ts +11 -0
- package/dist/solverRelay/publishIntents.js +41 -0
- package/dist/solverRelay/solverRelayHttpClient/apis.cjs +21 -0
- package/dist/solverRelay/solverRelayHttpClient/apis.d.cts +9 -0
- package/dist/solverRelay/solverRelayHttpClient/apis.d.ts +9 -0
- package/dist/solverRelay/solverRelayHttpClient/apis.js +18 -0
- package/dist/solverRelay/solverRelayHttpClient/index.cjs +18 -0
- package/dist/solverRelay/solverRelayHttpClient/index.d.cts +9 -0
- package/dist/solverRelay/solverRelayHttpClient/index.d.ts +9 -0
- package/dist/solverRelay/solverRelayHttpClient/index.js +13 -0
- package/dist/solverRelay/solverRelayHttpClient/runtime.cjs +60 -0
- package/dist/solverRelay/solverRelayHttpClient/runtime.js +58 -0
- package/dist/solverRelay/solverRelayHttpClient/types.d.cts +117 -0
- package/dist/solverRelay/solverRelayHttpClient/types.d.ts +117 -0
- package/dist/solverRelay/utils/parseFailedPublishError.cjs +64 -0
- package/dist/solverRelay/utils/parseFailedPublishError.d.cts +56 -0
- package/dist/solverRelay/utils/parseFailedPublishError.d.ts +57 -0
- package/dist/solverRelay/utils/parseFailedPublishError.js +61 -0
- package/dist/solverRelay/utils/quoteWithLog.cjs +21 -0
- package/dist/solverRelay/utils/quoteWithLog.d.cts +12 -0
- package/dist/solverRelay/utils/quoteWithLog.d.ts +14 -0
- package/dist/solverRelay/utils/quoteWithLog.js +21 -0
- package/dist/solverRelay/waitForIntentSettlement.cjs +52 -0
- package/dist/solverRelay/waitForIntentSettlement.d.cts +30 -0
- package/dist/solverRelay/waitForIntentSettlement.d.ts +30 -0
- package/dist/solverRelay/waitForIntentSettlement.js +52 -0
- package/dist/types/authHandle.cjs +22 -0
- package/dist/types/authHandle.d.cts +25 -0
- package/dist/types/authHandle.d.ts +25 -0
- package/dist/types/authHandle.js +16 -0
- package/dist/types/base.d.cts +45 -0
- package/dist/types/base.d.ts +45 -0
- package/dist/types/intentsUserId.d.cts +10 -0
- package/dist/types/intentsUserId.d.ts +10 -0
- package/dist/types/walletMessage.cjs +11 -0
- package/dist/types/walletMessage.d.cts +106 -0
- package/dist/types/walletMessage.d.ts +106 -0
- package/dist/types/walletMessage.js +5 -0
- package/dist/utils/abortSignal.cjs +19 -0
- package/dist/utils/abortSignal.js +18 -0
- package/dist/utils/appFee.cjs +20 -0
- package/dist/utils/appFee.d.cts +9 -0
- package/dist/utils/appFee.d.ts +9 -0
- package/dist/utils/appFee.js +15 -0
- package/dist/utils/assert.cjs +9 -0
- package/dist/utils/assert.d.cts +7 -0
- package/dist/utils/assert.d.ts +7 -0
- package/dist/utils/assert.js +9 -0
- package/dist/utils/authIdentity.cjs +56 -0
- package/dist/utils/authIdentity.d.cts +34 -0
- package/dist/utils/authIdentity.d.ts +34 -0
- package/dist/utils/authIdentity.js +50 -0
- package/dist/utils/failover.cjs +36 -0
- package/dist/utils/failover.d.cts +24 -0
- package/dist/utils/failover.d.ts +24 -0
- package/dist/utils/failover.js +34 -0
- package/dist/utils/handleRPCResponse.cjs +30 -0
- package/dist/utils/handleRPCResponse.js +28 -0
- package/dist/utils/handleResponse.cjs +31 -0
- package/dist/utils/handleResponse.js +29 -0
- package/dist/utils/index.cjs +55 -0
- package/dist/utils/index.d.cts +13 -0
- package/dist/utils/index.d.ts +13 -0
- package/dist/utils/index.js +50 -0
- package/dist/utils/messageFactory.cjs +137 -0
- package/dist/utils/messageFactory.d.cts +70 -0
- package/dist/utils/messageFactory.d.ts +70 -0
- package/dist/utils/messageFactory.js +132 -0
- package/dist/utils/multiPayload/webauthn.cjs +27 -0
- package/dist/utils/multiPayload/webauthn.js +26 -0
- package/dist/utils/near.cjs +58 -0
- package/dist/utils/near.d.cts +35 -0
- package/dist/utils/near.d.ts +35 -0
- package/dist/utils/near.js +53 -0
- package/dist/utils/poll.cjs +87 -0
- package/dist/utils/poll.d.cts +54 -0
- package/dist/utils/poll.d.ts +54 -0
- package/dist/utils/poll.js +85 -0
- package/dist/utils/prepareBroadcastRequest.cjs +98 -0
- package/dist/utils/prepareBroadcastRequest.d.cts +16 -0
- package/dist/utils/prepareBroadcastRequest.d.ts +16 -0
- package/dist/utils/prepareBroadcastRequest.js +90 -0
- package/dist/utils/promise/withTimeout.cjs +34 -0
- package/dist/utils/promise/withTimeout.d.cts +16 -0
- package/dist/utils/promise/withTimeout.d.ts +16 -0
- package/dist/utils/promise/withTimeout.js +34 -0
- package/dist/utils/request.cjs +100 -0
- package/dist/utils/request.d.cts +27 -0
- package/dist/utils/request.d.ts +27 -0
- package/dist/utils/request.js +99 -0
- package/dist/utils/requestShouldRetry.cjs +20 -0
- package/dist/utils/requestShouldRetry.js +20 -0
- package/dist/utils/retry.cjs +66 -0
- package/dist/utils/retry.d.cts +56 -0
- package/dist/utils/retry.d.ts +56 -0
- package/dist/utils/retry.js +64 -0
- package/dist/utils/rpc-endpoint.cjs +56 -0
- package/dist/utils/rpc-endpoint.d.cts +20 -0
- package/dist/utils/rpc-endpoint.d.ts +20 -0
- package/dist/utils/rpc-endpoint.js +54 -0
- package/dist/utils/serialize.cjs +82 -0
- package/dist/utils/serialize.d.cts +17 -0
- package/dist/utils/serialize.d.ts +17 -0
- package/dist/utils/serialize.js +81 -0
- package/dist/utils/stellarAddressToBytes.cjs +295 -0
- package/dist/utils/stellarAddressToBytes.js +294 -0
- package/dist/utils/token.cjs +8 -0
- package/dist/utils/token.js +7 -0
- package/dist/utils/tokenUtils.cjs +263 -0
- package/dist/utils/tokenUtils.d.cts +88 -0
- package/dist/utils/tokenUtils.d.ts +88 -0
- package/dist/utils/tokenUtils.js +238 -0
- package/dist/utils/tronAddressToHex.cjs +18 -0
- package/dist/utils/tronAddressToHex.js +17 -0
- package/dist/utils/uint8Array.cjs +15 -0
- package/dist/utils/uint8Array.d.cts +4 -0
- package/dist/utils/uint8Array.d.ts +4 -0
- package/dist/utils/uint8Array.js +14 -0
- package/dist/utils/webAuthn.cjs +58 -0
- package/dist/utils/webAuthn.js +56 -0
- package/dist/xrpl/index.cjs +13 -0
- package/dist/xrpl/index.d.cts +8 -0
- package/dist/xrpl/index.d.ts +8 -0
- package/dist/xrpl/index.js +8 -0
- package/dist/xrpl/xrplHttpClient/apis.cjs +28 -0
- package/dist/xrpl/xrplHttpClient/apis.d.cts +7 -0
- package/dist/xrpl/xrplHttpClient/apis.d.ts +7 -0
- package/dist/xrpl/xrplHttpClient/apis.js +27 -0
- package/dist/xrpl/xrplHttpClient/errors.cjs +27 -0
- package/dist/xrpl/xrplHttpClient/errors.d.cts +24 -0
- package/dist/xrpl/xrplHttpClient/errors.d.ts +24 -0
- package/dist/xrpl/xrplHttpClient/errors.js +26 -0
- package/dist/xrpl/xrplHttpClient/index.cjs +19 -0
- package/dist/xrpl/xrplHttpClient/index.d.cts +10 -0
- package/dist/xrpl/xrplHttpClient/index.d.ts +10 -0
- package/dist/xrpl/xrplHttpClient/index.js +14 -0
- package/dist/xrpl/xrplHttpClient/runtime.cjs +57 -0
- package/dist/xrpl/xrplHttpClient/runtime.js +55 -0
- package/dist/xrpl/xrplHttpClient/types.cjs +39 -0
- package/dist/xrpl/xrplHttpClient/types.d.cts +64 -0
- package/dist/xrpl/xrplHttpClient/types.d.ts +64 -0
- package/dist/xrpl/xrplHttpClient/types.js +35 -0
- package/package.json +59 -0
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { BaseTokenInfo, UnifiedTokenInfo } from "../types/base.js";
|
|
2
|
+
|
|
3
|
+
//#region src/utils/appFee.d.ts
|
|
4
|
+
declare namespace appFee_d_exports {
|
|
5
|
+
export { computeAppFeeBps };
|
|
6
|
+
}
|
|
7
|
+
declare function computeAppFeeBps(defaultAppFeeBps: number, token1: BaseTokenInfo | UnifiedTokenInfo, token2: BaseTokenInfo | UnifiedTokenInfo): number;
|
|
8
|
+
//#endregion
|
|
9
|
+
export { appFee_d_exports };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { __exportAll } from "../_virtual/rolldown_runtime.js";
|
|
2
|
+
|
|
3
|
+
//#region src/utils/appFee.ts
|
|
4
|
+
var appFee_exports = /* @__PURE__ */ __exportAll({ computeAppFeeBps: () => computeAppFeeBps });
|
|
5
|
+
function computeAppFeeBps(defaultAppFeeBps, token1, token2) {
|
|
6
|
+
if (hasTags(token1) && hasTags(token2) && token1.tags.includes("type:stablecoin") && token2.tags.includes("type:stablecoin")) return 0;
|
|
7
|
+
return defaultAppFeeBps;
|
|
8
|
+
}
|
|
9
|
+
function hasTags(a) {
|
|
10
|
+
if ("tags" in a) return true;
|
|
11
|
+
return false;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
//#endregion
|
|
15
|
+
export { appFee_exports };
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
const require_rolldown_runtime = require('../_virtual/rolldown_runtime.cjs');
|
|
2
|
+
const require_assert = require('./assert.cjs');
|
|
3
|
+
const require_stellarAddressToBytes = require('./stellarAddressToBytes.cjs');
|
|
4
|
+
const require_tronAddressToHex = require('./tronAddressToHex.cjs');
|
|
5
|
+
const require_webAuthn = require('./webAuthn.cjs');
|
|
6
|
+
let _noble_hashes_sha3 = require("@noble/hashes/sha3");
|
|
7
|
+
let _scure_base = require("@scure/base");
|
|
8
|
+
|
|
9
|
+
//#region src/utils/authIdentity.ts
|
|
10
|
+
var authIdentity_exports = /* @__PURE__ */ require_rolldown_runtime.__exportAll({ authHandleToIntentsUserId: () => authHandleToIntentsUserId });
|
|
11
|
+
function authHandleToIntentsUserId(authIdentifier, authMethod) {
|
|
12
|
+
let authHandle;
|
|
13
|
+
if (typeof authIdentifier === "object") authHandle = authIdentifier;
|
|
14
|
+
else if (authMethod != null) authHandle = {
|
|
15
|
+
identifier: authIdentifier,
|
|
16
|
+
method: authMethod
|
|
17
|
+
};
|
|
18
|
+
else throw new Error("Invalid arguments");
|
|
19
|
+
switch (authHandle.method) {
|
|
20
|
+
case "evm":
|
|
21
|
+
case "near": return authHandle.identifier.toLowerCase();
|
|
22
|
+
case "solana": return _scure_base.hex.encode(_scure_base.base58.decode(authHandle.identifier));
|
|
23
|
+
case "webauthn": return webAuthnIdentifierToIntentsUserId(authHandle.identifier);
|
|
24
|
+
case "ton":
|
|
25
|
+
require_assert.assert(authHandle.identifier.length === 64);
|
|
26
|
+
_scure_base.hex.decode(authHandle.identifier);
|
|
27
|
+
return authHandle.identifier.toLowerCase();
|
|
28
|
+
case "stellar": {
|
|
29
|
+
const decoded = require_stellarAddressToBytes.stellarAddressToBytes(authHandle.identifier);
|
|
30
|
+
return _scure_base.hex.encode(decoded);
|
|
31
|
+
}
|
|
32
|
+
case "tron": return `0x${require_tronAddressToHex.tronAddressToHex(authHandle.identifier).substring(2)}`;
|
|
33
|
+
default: throw new Error("Unsupported auth method");
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
function webAuthnIdentifierToIntentsUserId(credential) {
|
|
37
|
+
const { curveType, publicKey } = require_webAuthn.parsePublicKey(credential);
|
|
38
|
+
switch (curveType) {
|
|
39
|
+
case "p256": {
|
|
40
|
+
const p256 = new TextEncoder().encode("p256");
|
|
41
|
+
const addressBytes = (0, _noble_hashes_sha3.keccak_256)(new Uint8Array([...p256, ...publicKey])).slice(-20);
|
|
42
|
+
return "0x" + _scure_base.hex.encode(addressBytes);
|
|
43
|
+
}
|
|
44
|
+
case "ed25519": return _scure_base.hex.encode(publicKey);
|
|
45
|
+
default: throw new Error("Unsupported curve type");
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
//#endregion
|
|
50
|
+
exports.authHandleToIntentsUserId = authHandleToIntentsUserId;
|
|
51
|
+
Object.defineProperty(exports, 'authIdentity_exports', {
|
|
52
|
+
enumerable: true,
|
|
53
|
+
get: function () {
|
|
54
|
+
return authIdentity_exports;
|
|
55
|
+
}
|
|
56
|
+
});
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { IntentsUserId } from "../types/intentsUserId.cjs";
|
|
2
|
+
import { AuthHandle, AuthIdentifier, AuthMethod } from "../types/authHandle.cjs";
|
|
3
|
+
|
|
4
|
+
//#region src/utils/authIdentity.d.ts
|
|
5
|
+
declare namespace authIdentity_d_exports {
|
|
6
|
+
export { authHandleToIntentsUserId };
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Converts a blockchain address to a standardized Defuse user ID.
|
|
10
|
+
*
|
|
11
|
+
* The conversion follows these rules:
|
|
12
|
+
* 1. NEAR addresses: Used as-is (lowercased)
|
|
13
|
+
* - Explicit: "bob.near"
|
|
14
|
+
* - Implicit: "17208628f84f5d6ad33f0da3bbbeb27ffcb398eac501a31bd6ad2011e36133a1"
|
|
15
|
+
*
|
|
16
|
+
* 2. EVM addresses: Used as-is (lowercased)
|
|
17
|
+
* - Format: "0xc0ffee254729296a45a3885639ac7e10f9d54979"
|
|
18
|
+
*
|
|
19
|
+
* 3. Solana addresses: Converted from base58 to hex
|
|
20
|
+
* - Input: base58 public key
|
|
21
|
+
* - Output: hex-encoded string
|
|
22
|
+
*
|
|
23
|
+
* 4. WebAuthn credentials: Converted based on curve type
|
|
24
|
+
* - P-256: Keccak256(prefix + pubkey) -> last 20 bytes -> hex with 0x prefix
|
|
25
|
+
* - Ed25519: Raw public key -> hex encoding
|
|
26
|
+
*
|
|
27
|
+
* @param authIdentifier - The user's identifier (blockchain address or WebAuthn public key)
|
|
28
|
+
* @param authMethod - The type of credential ("evm", "near", "solana", "webauthn")
|
|
29
|
+
* @returns A standardized Defuse user ID
|
|
30
|
+
*/
|
|
31
|
+
declare function authHandleToIntentsUserId(authIdentifier: AuthIdentifier, authMethod: AuthMethod): IntentsUserId;
|
|
32
|
+
declare function authHandleToIntentsUserId(authHandle: AuthHandle): IntentsUserId;
|
|
33
|
+
//#endregion
|
|
34
|
+
export { authHandleToIntentsUserId, authIdentity_d_exports };
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { IntentsUserId } from "../types/intentsUserId.js";
|
|
2
|
+
import { AuthHandle, AuthIdentifier, AuthMethod } from "../types/authHandle.js";
|
|
3
|
+
|
|
4
|
+
//#region src/utils/authIdentity.d.ts
|
|
5
|
+
declare namespace authIdentity_d_exports {
|
|
6
|
+
export { authHandleToIntentsUserId };
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Converts a blockchain address to a standardized Defuse user ID.
|
|
10
|
+
*
|
|
11
|
+
* The conversion follows these rules:
|
|
12
|
+
* 1. NEAR addresses: Used as-is (lowercased)
|
|
13
|
+
* - Explicit: "bob.near"
|
|
14
|
+
* - Implicit: "17208628f84f5d6ad33f0da3bbbeb27ffcb398eac501a31bd6ad2011e36133a1"
|
|
15
|
+
*
|
|
16
|
+
* 2. EVM addresses: Used as-is (lowercased)
|
|
17
|
+
* - Format: "0xc0ffee254729296a45a3885639ac7e10f9d54979"
|
|
18
|
+
*
|
|
19
|
+
* 3. Solana addresses: Converted from base58 to hex
|
|
20
|
+
* - Input: base58 public key
|
|
21
|
+
* - Output: hex-encoded string
|
|
22
|
+
*
|
|
23
|
+
* 4. WebAuthn credentials: Converted based on curve type
|
|
24
|
+
* - P-256: Keccak256(prefix + pubkey) -> last 20 bytes -> hex with 0x prefix
|
|
25
|
+
* - Ed25519: Raw public key -> hex encoding
|
|
26
|
+
*
|
|
27
|
+
* @param authIdentifier - The user's identifier (blockchain address or WebAuthn public key)
|
|
28
|
+
* @param authMethod - The type of credential ("evm", "near", "solana", "webauthn")
|
|
29
|
+
* @returns A standardized Defuse user ID
|
|
30
|
+
*/
|
|
31
|
+
declare function authHandleToIntentsUserId(authIdentifier: AuthIdentifier, authMethod: AuthMethod): IntentsUserId;
|
|
32
|
+
declare function authHandleToIntentsUserId(authHandle: AuthHandle): IntentsUserId;
|
|
33
|
+
//#endregion
|
|
34
|
+
export { authHandleToIntentsUserId, authIdentity_d_exports };
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { __exportAll } from "../_virtual/rolldown_runtime.js";
|
|
2
|
+
import { assert } from "./assert.js";
|
|
3
|
+
import { stellarAddressToBytes } from "./stellarAddressToBytes.js";
|
|
4
|
+
import { tronAddressToHex } from "./tronAddressToHex.js";
|
|
5
|
+
import { parsePublicKey } from "./webAuthn.js";
|
|
6
|
+
import { keccak_256 } from "@noble/hashes/sha3";
|
|
7
|
+
import { base58, hex } from "@scure/base";
|
|
8
|
+
|
|
9
|
+
//#region src/utils/authIdentity.ts
|
|
10
|
+
var authIdentity_exports = /* @__PURE__ */ __exportAll({ authHandleToIntentsUserId: () => authHandleToIntentsUserId });
|
|
11
|
+
function authHandleToIntentsUserId(authIdentifier, authMethod) {
|
|
12
|
+
let authHandle;
|
|
13
|
+
if (typeof authIdentifier === "object") authHandle = authIdentifier;
|
|
14
|
+
else if (authMethod != null) authHandle = {
|
|
15
|
+
identifier: authIdentifier,
|
|
16
|
+
method: authMethod
|
|
17
|
+
};
|
|
18
|
+
else throw new Error("Invalid arguments");
|
|
19
|
+
switch (authHandle.method) {
|
|
20
|
+
case "evm":
|
|
21
|
+
case "near": return authHandle.identifier.toLowerCase();
|
|
22
|
+
case "solana": return hex.encode(base58.decode(authHandle.identifier));
|
|
23
|
+
case "webauthn": return webAuthnIdentifierToIntentsUserId(authHandle.identifier);
|
|
24
|
+
case "ton":
|
|
25
|
+
assert(authHandle.identifier.length === 64);
|
|
26
|
+
hex.decode(authHandle.identifier);
|
|
27
|
+
return authHandle.identifier.toLowerCase();
|
|
28
|
+
case "stellar": {
|
|
29
|
+
const decoded = stellarAddressToBytes(authHandle.identifier);
|
|
30
|
+
return hex.encode(decoded);
|
|
31
|
+
}
|
|
32
|
+
case "tron": return `0x${tronAddressToHex(authHandle.identifier).substring(2)}`;
|
|
33
|
+
default: throw new Error("Unsupported auth method");
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
function webAuthnIdentifierToIntentsUserId(credential) {
|
|
37
|
+
const { curveType, publicKey } = parsePublicKey(credential);
|
|
38
|
+
switch (curveType) {
|
|
39
|
+
case "p256": {
|
|
40
|
+
const p256 = new TextEncoder().encode("p256");
|
|
41
|
+
const addressBytes = keccak_256(new Uint8Array([...p256, ...publicKey])).slice(-20);
|
|
42
|
+
return "0x" + hex.encode(addressBytes);
|
|
43
|
+
}
|
|
44
|
+
case "ed25519": return hex.encode(publicKey);
|
|
45
|
+
default: throw new Error("Unsupported curve type");
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
//#endregion
|
|
50
|
+
export { authHandleToIntentsUserId, authIdentity_exports };
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
const require_rolldown_runtime = require('../_virtual/rolldown_runtime.cjs');
|
|
2
|
+
const require_rpc_endpoint = require('./rpc-endpoint.cjs');
|
|
3
|
+
let near_api_js = require("near-api-js");
|
|
4
|
+
|
|
5
|
+
//#region src/utils/failover.ts
|
|
6
|
+
/**
|
|
7
|
+
* Creates a NEAR failover RPC provider from a list of endpoints.
|
|
8
|
+
*
|
|
9
|
+
* @note This function is specifically designed for NEAR RPC providers
|
|
10
|
+
* and should not be used with other blockchain networks.
|
|
11
|
+
*
|
|
12
|
+
* Supports:
|
|
13
|
+
* - Plain URL strings: "https://rpc.example.com"
|
|
14
|
+
* - URLs with embedded credentials: "http://user:pass@host:3030" (auto-converted to Authorization header)
|
|
15
|
+
* - Config objects: { url: "https://rpc.example.com", headers: { "Authorization": "..." } }
|
|
16
|
+
*/
|
|
17
|
+
function nearFailoverRpcProvider({ urls }) {
|
|
18
|
+
return createNearFailoverRpcProvider({ providers: urls.map((endpoint) => {
|
|
19
|
+
const { url, headers } = require_rpc_endpoint.normalizeRpcEndpoint(endpoint);
|
|
20
|
+
return new near_api_js.providers.JsonRpcProvider({
|
|
21
|
+
url,
|
|
22
|
+
headers
|
|
23
|
+
});
|
|
24
|
+
}) });
|
|
25
|
+
}
|
|
26
|
+
function createNearFailoverRpcProvider({ providers: list }) {
|
|
27
|
+
return new near_api_js.providers.FailoverRpcProvider(list);
|
|
28
|
+
}
|
|
29
|
+
function unwrapNearFailoverRpcProvider(provider) {
|
|
30
|
+
if (provider instanceof near_api_js.providers.FailoverRpcProvider && provider.providers.length > 0 && provider.providers[0]) return provider.providers[0];
|
|
31
|
+
return provider;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
//#endregion
|
|
35
|
+
exports.nearFailoverRpcProvider = nearFailoverRpcProvider;
|
|
36
|
+
exports.unwrapNearFailoverRpcProvider = unwrapNearFailoverRpcProvider;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { RpcEndpoint } from "./rpc-endpoint.cjs";
|
|
2
|
+
import { providers } from "near-api-js";
|
|
3
|
+
|
|
4
|
+
//#region src/utils/failover.d.ts
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Creates a NEAR failover RPC provider from a list of endpoints.
|
|
8
|
+
*
|
|
9
|
+
* @note This function is specifically designed for NEAR RPC providers
|
|
10
|
+
* and should not be used with other blockchain networks.
|
|
11
|
+
*
|
|
12
|
+
* Supports:
|
|
13
|
+
* - Plain URL strings: "https://rpc.example.com"
|
|
14
|
+
* - URLs with embedded credentials: "http://user:pass@host:3030" (auto-converted to Authorization header)
|
|
15
|
+
* - Config objects: { url: "https://rpc.example.com", headers: { "Authorization": "..." } }
|
|
16
|
+
*/
|
|
17
|
+
declare function nearFailoverRpcProvider({
|
|
18
|
+
urls
|
|
19
|
+
}: {
|
|
20
|
+
urls: RpcEndpoint[];
|
|
21
|
+
}): providers.FailoverRpcProvider;
|
|
22
|
+
declare function unwrapNearFailoverRpcProvider(provider: providers.Provider): providers.Provider;
|
|
23
|
+
//#endregion
|
|
24
|
+
export { nearFailoverRpcProvider, unwrapNearFailoverRpcProvider };
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { RpcEndpoint } from "./rpc-endpoint.js";
|
|
2
|
+
import { providers } from "near-api-js";
|
|
3
|
+
|
|
4
|
+
//#region src/utils/failover.d.ts
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Creates a NEAR failover RPC provider from a list of endpoints.
|
|
8
|
+
*
|
|
9
|
+
* @note This function is specifically designed for NEAR RPC providers
|
|
10
|
+
* and should not be used with other blockchain networks.
|
|
11
|
+
*
|
|
12
|
+
* Supports:
|
|
13
|
+
* - Plain URL strings: "https://rpc.example.com"
|
|
14
|
+
* - URLs with embedded credentials: "http://user:pass@host:3030" (auto-converted to Authorization header)
|
|
15
|
+
* - Config objects: { url: "https://rpc.example.com", headers: { "Authorization": "..." } }
|
|
16
|
+
*/
|
|
17
|
+
declare function nearFailoverRpcProvider({
|
|
18
|
+
urls
|
|
19
|
+
}: {
|
|
20
|
+
urls: RpcEndpoint[];
|
|
21
|
+
}): providers.FailoverRpcProvider;
|
|
22
|
+
declare function unwrapNearFailoverRpcProvider(provider: providers.Provider): providers.Provider;
|
|
23
|
+
//#endregion
|
|
24
|
+
export { nearFailoverRpcProvider, unwrapNearFailoverRpcProvider };
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { normalizeRpcEndpoint } from "./rpc-endpoint.js";
|
|
2
|
+
import { providers } from "near-api-js";
|
|
3
|
+
|
|
4
|
+
//#region src/utils/failover.ts
|
|
5
|
+
/**
|
|
6
|
+
* Creates a NEAR failover RPC provider from a list of endpoints.
|
|
7
|
+
*
|
|
8
|
+
* @note This function is specifically designed for NEAR RPC providers
|
|
9
|
+
* and should not be used with other blockchain networks.
|
|
10
|
+
*
|
|
11
|
+
* Supports:
|
|
12
|
+
* - Plain URL strings: "https://rpc.example.com"
|
|
13
|
+
* - URLs with embedded credentials: "http://user:pass@host:3030" (auto-converted to Authorization header)
|
|
14
|
+
* - Config objects: { url: "https://rpc.example.com", headers: { "Authorization": "..." } }
|
|
15
|
+
*/
|
|
16
|
+
function nearFailoverRpcProvider({ urls }) {
|
|
17
|
+
return createNearFailoverRpcProvider({ providers: urls.map((endpoint) => {
|
|
18
|
+
const { url, headers } = normalizeRpcEndpoint(endpoint);
|
|
19
|
+
return new providers.JsonRpcProvider({
|
|
20
|
+
url,
|
|
21
|
+
headers
|
|
22
|
+
});
|
|
23
|
+
}) });
|
|
24
|
+
}
|
|
25
|
+
function createNearFailoverRpcProvider({ providers: list }) {
|
|
26
|
+
return new providers.FailoverRpcProvider(list);
|
|
27
|
+
}
|
|
28
|
+
function unwrapNearFailoverRpcProvider(provider) {
|
|
29
|
+
if (provider instanceof providers.FailoverRpcProvider && provider.providers.length > 0 && provider.providers[0]) return provider.providers[0];
|
|
30
|
+
return provider;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
//#endregion
|
|
34
|
+
export { nearFailoverRpcProvider, unwrapNearFailoverRpcProvider };
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
const require_rolldown_runtime = require('../_virtual/rolldown_runtime.cjs');
|
|
2
|
+
const require_request = require('../errors/request.cjs');
|
|
3
|
+
let valibot = require("valibot");
|
|
4
|
+
valibot = require_rolldown_runtime.__toESM(valibot);
|
|
5
|
+
|
|
6
|
+
//#region src/utils/handleRPCResponse.ts
|
|
7
|
+
async function handleRPCResponse(response, body, schema) {
|
|
8
|
+
const json = await response.json();
|
|
9
|
+
const parsed = valibot.safeParse(schema, json);
|
|
10
|
+
if (parsed.success) {
|
|
11
|
+
if (parsed.output.error !== void 0) throw new require_request.RpcRequestError({
|
|
12
|
+
body,
|
|
13
|
+
error: parsed.output.error,
|
|
14
|
+
url: response.url
|
|
15
|
+
});
|
|
16
|
+
return parsed.output.result;
|
|
17
|
+
}
|
|
18
|
+
throw new require_request.RpcRequestError({
|
|
19
|
+
body,
|
|
20
|
+
error: {
|
|
21
|
+
code: -1,
|
|
22
|
+
data: json,
|
|
23
|
+
message: "Invalid response"
|
|
24
|
+
},
|
|
25
|
+
url: response.url
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
//#endregion
|
|
30
|
+
exports.handleRPCResponse = handleRPCResponse;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { RpcRequestError } from "../errors/request.js";
|
|
2
|
+
import * as v from "valibot";
|
|
3
|
+
|
|
4
|
+
//#region src/utils/handleRPCResponse.ts
|
|
5
|
+
async function handleRPCResponse(response, body, schema) {
|
|
6
|
+
const json = await response.json();
|
|
7
|
+
const parsed = v.safeParse(schema, json);
|
|
8
|
+
if (parsed.success) {
|
|
9
|
+
if (parsed.output.error !== void 0) throw new RpcRequestError({
|
|
10
|
+
body,
|
|
11
|
+
error: parsed.output.error,
|
|
12
|
+
url: response.url
|
|
13
|
+
});
|
|
14
|
+
return parsed.output.result;
|
|
15
|
+
}
|
|
16
|
+
throw new RpcRequestError({
|
|
17
|
+
body,
|
|
18
|
+
error: {
|
|
19
|
+
code: -1,
|
|
20
|
+
data: json,
|
|
21
|
+
message: "Invalid response"
|
|
22
|
+
},
|
|
23
|
+
url: response.url
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
//#endregion
|
|
28
|
+
export { handleRPCResponse };
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
const require_rolldown_runtime = require('../_virtual/rolldown_runtime.cjs');
|
|
2
|
+
const require_serialize = require('./serialize.cjs');
|
|
3
|
+
const require_request = require('../errors/request.cjs');
|
|
4
|
+
let valibot = require("valibot");
|
|
5
|
+
valibot = require_rolldown_runtime.__toESM(valibot);
|
|
6
|
+
|
|
7
|
+
//#region src/utils/handleResponse.ts
|
|
8
|
+
async function handleResponse(response, body, schema) {
|
|
9
|
+
let json;
|
|
10
|
+
try {
|
|
11
|
+
json = await response.json();
|
|
12
|
+
} catch (error) {
|
|
13
|
+
throw new require_request.HttpRequestError({
|
|
14
|
+
body,
|
|
15
|
+
details: "Failed to deserialize JSON",
|
|
16
|
+
cause: error instanceof Error ? error : new Error(String(error)),
|
|
17
|
+
url: response.url
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
const parsed = valibot.safeParse(schema, json);
|
|
21
|
+
if (parsed.success) return parsed.output;
|
|
22
|
+
throw new require_request.HttpRequestError({
|
|
23
|
+
body,
|
|
24
|
+
details: "Failed to parse response JSON",
|
|
25
|
+
cause: new Error(require_serialize.serialize(parsed.issues)),
|
|
26
|
+
url: response.url
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
//#endregion
|
|
31
|
+
exports.handleResponse = handleResponse;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { serialize } from "./serialize.js";
|
|
2
|
+
import { HttpRequestError } from "../errors/request.js";
|
|
3
|
+
import * as v from "valibot";
|
|
4
|
+
|
|
5
|
+
//#region src/utils/handleResponse.ts
|
|
6
|
+
async function handleResponse(response, body, schema) {
|
|
7
|
+
let json;
|
|
8
|
+
try {
|
|
9
|
+
json = await response.json();
|
|
10
|
+
} catch (error) {
|
|
11
|
+
throw new HttpRequestError({
|
|
12
|
+
body,
|
|
13
|
+
details: "Failed to deserialize JSON",
|
|
14
|
+
cause: error instanceof Error ? error : new Error(String(error)),
|
|
15
|
+
url: response.url
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
const parsed = v.safeParse(schema, json);
|
|
19
|
+
if (parsed.success) return parsed.output;
|
|
20
|
+
throw new HttpRequestError({
|
|
21
|
+
body,
|
|
22
|
+
details: "Failed to parse response JSON",
|
|
23
|
+
cause: new Error(serialize(parsed.issues)),
|
|
24
|
+
url: response.url
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
//#endregion
|
|
29
|
+
export { handleResponse };
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
const require_rolldown_runtime = require('../_virtual/rolldown_runtime.cjs');
|
|
2
|
+
const require_assert = require('./assert.cjs');
|
|
3
|
+
const require_uint8Array = require('./uint8Array.cjs');
|
|
4
|
+
const require_authIdentity = require('./authIdentity.cjs');
|
|
5
|
+
const require_prepareBroadcastRequest = require('./prepareBroadcastRequest.cjs');
|
|
6
|
+
const require_near = require('./near.cjs');
|
|
7
|
+
const require_tokenUtils = require('./tokenUtils.cjs');
|
|
8
|
+
|
|
9
|
+
//#region src/utils/index.ts
|
|
10
|
+
var utils_exports = /* @__PURE__ */ require_rolldown_runtime.__exportAll({
|
|
11
|
+
BASIS_POINTS_DENOMINATOR: () => require_tokenUtils.BASIS_POINTS_DENOMINATOR,
|
|
12
|
+
DuplicateTokenError: () => require_tokenUtils.DuplicateTokenError,
|
|
13
|
+
accountSlippageExactIn: () => require_tokenUtils.accountSlippageExactIn,
|
|
14
|
+
addAmounts: () => require_tokenUtils.addAmounts,
|
|
15
|
+
adjustDecimals: () => require_tokenUtils.adjustDecimals,
|
|
16
|
+
adjustDecimalsTokenValue: () => require_tokenUtils.adjustDecimalsTokenValue,
|
|
17
|
+
assert: () => require_assert.assert,
|
|
18
|
+
authHandleToIntentsUserId: () => require_authIdentity.authHandleToIntentsUserId,
|
|
19
|
+
compareAmounts: () => require_tokenUtils.compareAmounts,
|
|
20
|
+
computeTotalBalance: () => require_tokenUtils.computeTotalBalance,
|
|
21
|
+
computeTotalBalanceDifferentDecimals: () => require_tokenUtils.computeTotalBalanceDifferentDecimals,
|
|
22
|
+
computeTotalDeltaDifferentDecimals: () => require_tokenUtils.computeTotalDeltaDifferentDecimals,
|
|
23
|
+
concatUint8Arrays: () => require_uint8Array.concatUint8Arrays,
|
|
24
|
+
decodeQueryResult: () => require_near.decodeQueryResult,
|
|
25
|
+
deduplicateTokens: () => require_tokenUtils.deduplicateTokens,
|
|
26
|
+
filterOutPoaBridgeTokens: () => require_tokenUtils.filterOutPoaBridgeTokens,
|
|
27
|
+
getAnyBaseTokenInfo: () => require_tokenUtils.getAnyBaseTokenInfo,
|
|
28
|
+
getDerivedToken: () => require_tokenUtils.getDerivedToken,
|
|
29
|
+
getTokenAccountId: () => require_tokenUtils.getTokenAccountId,
|
|
30
|
+
getTokenAccountIds: () => require_tokenUtils.getTokenAccountIds,
|
|
31
|
+
getTokenMaxDecimals: () => require_tokenUtils.getTokenMaxDecimals,
|
|
32
|
+
getUnderlyingBaseTokenInfos: () => require_tokenUtils.getUnderlyingBaseTokenInfos,
|
|
33
|
+
grossUpAmount: () => require_tokenUtils.grossUpAmount,
|
|
34
|
+
isImplicitAccount: () => require_near.isImplicitAccount,
|
|
35
|
+
minAmounts: () => require_tokenUtils.minAmounts,
|
|
36
|
+
negateTokenValue: () => require_tokenUtils.negateTokenValue,
|
|
37
|
+
netDownAmount: () => require_tokenUtils.netDownAmount,
|
|
38
|
+
normalizeERC191Signature: () => require_prepareBroadcastRequest.normalizeERC191Signature,
|
|
39
|
+
parseDefuseAssetId: () => require_tokenUtils.parseDefuseAssetId,
|
|
40
|
+
prepareSwapSignedData: () => require_prepareBroadcastRequest.prepareSwapSignedData,
|
|
41
|
+
queryContract: () => require_near.queryContract,
|
|
42
|
+
subtractAmounts: () => require_tokenUtils.subtractAmounts,
|
|
43
|
+
tokenAccountIdToDefuseAssetId: () => require_tokenUtils.tokenAccountIdToDefuseAssetId,
|
|
44
|
+
transformERC191Signature: () => require_prepareBroadcastRequest.transformERC191Signature,
|
|
45
|
+
truncateTokenValue: () => require_tokenUtils.truncateTokenValue,
|
|
46
|
+
validateNearAddress: () => require_near.validateNearAddress
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
//#endregion
|
|
50
|
+
Object.defineProperty(exports, 'utils_exports', {
|
|
51
|
+
enumerable: true,
|
|
52
|
+
get: function () {
|
|
53
|
+
return utils_exports;
|
|
54
|
+
}
|
|
55
|
+
});
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { AssertErrorType, assert } from "./assert.cjs";
|
|
2
|
+
import { authHandleToIntentsUserId } from "./authIdentity.cjs";
|
|
3
|
+
import { normalizeERC191Signature, prepareSwapSignedData, transformERC191Signature } from "./prepareBroadcastRequest.cjs";
|
|
4
|
+
import { BASIS_POINTS_DENOMINATOR, DuplicateTokenError, ParseDefuseAssetIdErrorType, ParseDefuseAssetIdReturnType, accountSlippageExactIn, addAmounts, adjustDecimals, adjustDecimalsTokenValue, compareAmounts, computeTotalBalance, computeTotalBalanceDifferentDecimals, computeTotalDeltaDifferentDecimals, deduplicateTokens, filterOutPoaBridgeTokens, getAnyBaseTokenInfo, getDerivedToken, getTokenAccountId, getTokenAccountIds, getTokenMaxDecimals, getUnderlyingBaseTokenInfos, grossUpAmount, minAmounts, negateTokenValue, netDownAmount, parseDefuseAssetId, subtractAmounts, tokenAccountIdToDefuseAssetId, truncateTokenValue } from "./tokenUtils.cjs";
|
|
5
|
+
import { OptionalBlockReference, decodeQueryResult, isImplicitAccount, queryContract, validateNearAddress } from "./near.cjs";
|
|
6
|
+
import { concatUint8Arrays } from "./uint8Array.cjs";
|
|
7
|
+
|
|
8
|
+
//#region src/utils/index.d.ts
|
|
9
|
+
declare namespace index_d_exports {
|
|
10
|
+
export { AssertErrorType, BASIS_POINTS_DENOMINATOR, DuplicateTokenError, OptionalBlockReference, ParseDefuseAssetIdErrorType, ParseDefuseAssetIdReturnType, accountSlippageExactIn, addAmounts, adjustDecimals, adjustDecimalsTokenValue, assert, authHandleToIntentsUserId, compareAmounts, computeTotalBalance, computeTotalBalanceDifferentDecimals, computeTotalDeltaDifferentDecimals, concatUint8Arrays, decodeQueryResult, deduplicateTokens, filterOutPoaBridgeTokens, getAnyBaseTokenInfo, getDerivedToken, getTokenAccountId, getTokenAccountIds, getTokenMaxDecimals, getUnderlyingBaseTokenInfos, grossUpAmount, isImplicitAccount, minAmounts, negateTokenValue, netDownAmount, normalizeERC191Signature, parseDefuseAssetId, prepareSwapSignedData, queryContract, subtractAmounts, tokenAccountIdToDefuseAssetId, transformERC191Signature, truncateTokenValue, validateNearAddress };
|
|
11
|
+
}
|
|
12
|
+
//#endregion
|
|
13
|
+
export { index_d_exports };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { AssertErrorType, assert } from "./assert.js";
|
|
2
|
+
import { authHandleToIntentsUserId } from "./authIdentity.js";
|
|
3
|
+
import { normalizeERC191Signature, prepareSwapSignedData, transformERC191Signature } from "./prepareBroadcastRequest.js";
|
|
4
|
+
import { BASIS_POINTS_DENOMINATOR, DuplicateTokenError, ParseDefuseAssetIdErrorType, ParseDefuseAssetIdReturnType, accountSlippageExactIn, addAmounts, adjustDecimals, adjustDecimalsTokenValue, compareAmounts, computeTotalBalance, computeTotalBalanceDifferentDecimals, computeTotalDeltaDifferentDecimals, deduplicateTokens, filterOutPoaBridgeTokens, getAnyBaseTokenInfo, getDerivedToken, getTokenAccountId, getTokenAccountIds, getTokenMaxDecimals, getUnderlyingBaseTokenInfos, grossUpAmount, minAmounts, negateTokenValue, netDownAmount, parseDefuseAssetId, subtractAmounts, tokenAccountIdToDefuseAssetId, truncateTokenValue } from "./tokenUtils.js";
|
|
5
|
+
import { OptionalBlockReference, decodeQueryResult, isImplicitAccount, queryContract, validateNearAddress } from "./near.js";
|
|
6
|
+
import { concatUint8Arrays } from "./uint8Array.js";
|
|
7
|
+
|
|
8
|
+
//#region src/utils/index.d.ts
|
|
9
|
+
declare namespace index_d_exports {
|
|
10
|
+
export { AssertErrorType, BASIS_POINTS_DENOMINATOR, DuplicateTokenError, OptionalBlockReference, ParseDefuseAssetIdErrorType, ParseDefuseAssetIdReturnType, accountSlippageExactIn, addAmounts, adjustDecimals, adjustDecimalsTokenValue, assert, authHandleToIntentsUserId, compareAmounts, computeTotalBalance, computeTotalBalanceDifferentDecimals, computeTotalDeltaDifferentDecimals, concatUint8Arrays, decodeQueryResult, deduplicateTokens, filterOutPoaBridgeTokens, getAnyBaseTokenInfo, getDerivedToken, getTokenAccountId, getTokenAccountIds, getTokenMaxDecimals, getUnderlyingBaseTokenInfos, grossUpAmount, isImplicitAccount, minAmounts, negateTokenValue, netDownAmount, normalizeERC191Signature, parseDefuseAssetId, prepareSwapSignedData, queryContract, subtractAmounts, tokenAccountIdToDefuseAssetId, transformERC191Signature, truncateTokenValue, validateNearAddress };
|
|
11
|
+
}
|
|
12
|
+
//#endregion
|
|
13
|
+
export { index_d_exports };
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { __exportAll } from "../_virtual/rolldown_runtime.js";
|
|
2
|
+
import { assert } from "./assert.js";
|
|
3
|
+
import { concatUint8Arrays } from "./uint8Array.js";
|
|
4
|
+
import { authHandleToIntentsUserId } from "./authIdentity.js";
|
|
5
|
+
import { normalizeERC191Signature, prepareSwapSignedData, transformERC191Signature } from "./prepareBroadcastRequest.js";
|
|
6
|
+
import { decodeQueryResult, isImplicitAccount, queryContract, validateNearAddress } from "./near.js";
|
|
7
|
+
import { BASIS_POINTS_DENOMINATOR, DuplicateTokenError, accountSlippageExactIn, addAmounts, adjustDecimals, adjustDecimalsTokenValue, compareAmounts, computeTotalBalance, computeTotalBalanceDifferentDecimals, computeTotalDeltaDifferentDecimals, deduplicateTokens, filterOutPoaBridgeTokens, getAnyBaseTokenInfo, getDerivedToken, getTokenAccountId, getTokenAccountIds, getTokenMaxDecimals, getUnderlyingBaseTokenInfos, grossUpAmount, minAmounts, negateTokenValue, netDownAmount, parseDefuseAssetId, subtractAmounts, tokenAccountIdToDefuseAssetId, truncateTokenValue } from "./tokenUtils.js";
|
|
8
|
+
|
|
9
|
+
//#region src/utils/index.ts
|
|
10
|
+
var utils_exports = /* @__PURE__ */ __exportAll({
|
|
11
|
+
BASIS_POINTS_DENOMINATOR: () => BASIS_POINTS_DENOMINATOR,
|
|
12
|
+
DuplicateTokenError: () => DuplicateTokenError,
|
|
13
|
+
accountSlippageExactIn: () => accountSlippageExactIn,
|
|
14
|
+
addAmounts: () => addAmounts,
|
|
15
|
+
adjustDecimals: () => adjustDecimals,
|
|
16
|
+
adjustDecimalsTokenValue: () => adjustDecimalsTokenValue,
|
|
17
|
+
assert: () => assert,
|
|
18
|
+
authHandleToIntentsUserId: () => authHandleToIntentsUserId,
|
|
19
|
+
compareAmounts: () => compareAmounts,
|
|
20
|
+
computeTotalBalance: () => computeTotalBalance,
|
|
21
|
+
computeTotalBalanceDifferentDecimals: () => computeTotalBalanceDifferentDecimals,
|
|
22
|
+
computeTotalDeltaDifferentDecimals: () => computeTotalDeltaDifferentDecimals,
|
|
23
|
+
concatUint8Arrays: () => concatUint8Arrays,
|
|
24
|
+
decodeQueryResult: () => decodeQueryResult,
|
|
25
|
+
deduplicateTokens: () => deduplicateTokens,
|
|
26
|
+
filterOutPoaBridgeTokens: () => filterOutPoaBridgeTokens,
|
|
27
|
+
getAnyBaseTokenInfo: () => getAnyBaseTokenInfo,
|
|
28
|
+
getDerivedToken: () => getDerivedToken,
|
|
29
|
+
getTokenAccountId: () => getTokenAccountId,
|
|
30
|
+
getTokenAccountIds: () => getTokenAccountIds,
|
|
31
|
+
getTokenMaxDecimals: () => getTokenMaxDecimals,
|
|
32
|
+
getUnderlyingBaseTokenInfos: () => getUnderlyingBaseTokenInfos,
|
|
33
|
+
grossUpAmount: () => grossUpAmount,
|
|
34
|
+
isImplicitAccount: () => isImplicitAccount,
|
|
35
|
+
minAmounts: () => minAmounts,
|
|
36
|
+
negateTokenValue: () => negateTokenValue,
|
|
37
|
+
netDownAmount: () => netDownAmount,
|
|
38
|
+
normalizeERC191Signature: () => normalizeERC191Signature,
|
|
39
|
+
parseDefuseAssetId: () => parseDefuseAssetId,
|
|
40
|
+
prepareSwapSignedData: () => prepareSwapSignedData,
|
|
41
|
+
queryContract: () => queryContract,
|
|
42
|
+
subtractAmounts: () => subtractAmounts,
|
|
43
|
+
tokenAccountIdToDefuseAssetId: () => tokenAccountIdToDefuseAssetId,
|
|
44
|
+
transformERC191Signature: () => transformERC191Signature,
|
|
45
|
+
truncateTokenValue: () => truncateTokenValue,
|
|
46
|
+
validateNearAddress: () => validateNearAddress
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
//#endregion
|
|
50
|
+
export { utils_exports };
|