@drakkar.software/octobot-client 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +140 -0
- package/dist/client/adapters/accounts.d.ts +66 -0
- package/dist/client/adapters/accounts.d.ts.map +1 -0
- package/dist/client/adapters/accounts.js +214 -0
- package/dist/client/adapters/accounts.js.map +1 -0
- package/dist/client/adapters/actionHandle.d.ts +29 -0
- package/dist/client/adapters/actionHandle.d.ts.map +1 -0
- package/dist/client/adapters/actionHandle.js +34 -0
- package/dist/client/adapters/actionHandle.js.map +1 -0
- package/dist/client/adapters/automations.d.ts +31 -0
- package/dist/client/adapters/automations.d.ts.map +1 -0
- package/dist/client/adapters/automations.js +79 -0
- package/dist/client/adapters/automations.js.map +1 -0
- package/dist/client/adapters/documents.d.ts +55 -0
- package/dist/client/adapters/documents.d.ts.map +1 -0
- package/dist/client/adapters/documents.js +66 -0
- package/dist/client/adapters/documents.js.map +1 -0
- package/dist/client/adapters/nodeApi.d.ts +25 -0
- package/dist/client/adapters/nodeApi.d.ts.map +1 -0
- package/dist/client/adapters/nodeApi.js +81 -0
- package/dist/client/adapters/nodeApi.js.map +1 -0
- package/dist/client/adapters/settings.d.ts +16 -0
- package/dist/client/adapters/settings.d.ts.map +1 -0
- package/dist/client/adapters/settings.js +43 -0
- package/dist/client/adapters/settings.js.map +1 -0
- package/dist/client/adapters/strategies.d.ts +17 -0
- package/dist/client/adapters/strategies.d.ts.map +1 -0
- package/dist/client/adapters/strategies.js +75 -0
- package/dist/client/adapters/strategies.js.map +1 -0
- package/dist/client/connect/connect.d.ts +40 -0
- package/dist/client/connect/connect.d.ts.map +1 -0
- package/dist/client/connect/connect.js +133 -0
- package/dist/client/connect/connect.js.map +1 -0
- package/dist/client/connect/readOnly.d.ts +97 -0
- package/dist/client/connect/readOnly.d.ts.map +1 -0
- package/dist/client/connect/readOnly.js +167 -0
- package/dist/client/connect/readOnly.js.map +1 -0
- package/dist/client/core/errors.d.ts +80 -0
- package/dist/client/core/errors.d.ts.map +1 -0
- package/dist/client/core/errors.js +154 -0
- package/dist/client/core/errors.js.map +1 -0
- package/dist/client/core/options.d.ts +44 -0
- package/dist/client/core/options.d.ts.map +1 -0
- package/dist/client/core/options.js +2 -0
- package/dist/client/core/options.js.map +1 -0
- package/dist/client/core/session.d.ts +90 -0
- package/dist/client/core/session.d.ts.map +1 -0
- package/dist/client/core/session.js +72 -0
- package/dist/client/core/session.js.map +1 -0
- package/dist/client/core/views.d.ts +40 -0
- package/dist/client/core/views.d.ts.map +1 -0
- package/dist/client/core/views.js +32 -0
- package/dist/client/core/views.js.map +1 -0
- package/dist/client/index.d.ts +16 -0
- package/dist/client/index.d.ts.map +1 -0
- package/dist/client/index.js +9 -0
- package/dist/client/index.js.map +1 -0
- package/dist/client/mirror/collections.d.ts +125 -0
- package/dist/client/mirror/collections.d.ts.map +1 -0
- package/dist/client/mirror/collections.js +118 -0
- package/dist/client/mirror/collections.js.map +1 -0
- package/dist/client/mirror/index.d.ts +4 -0
- package/dist/client/mirror/index.d.ts.map +1 -0
- package/dist/client/mirror/index.js +4 -0
- package/dist/client/mirror/index.js.map +1 -0
- package/dist/client/mirror/writer.d.ts +39 -0
- package/dist/client/mirror/writer.d.ts.map +1 -0
- package/dist/client/mirror/writer.js +50 -0
- package/dist/client/mirror/writer.js.map +1 -0
- package/dist/client/pairing/mirrorGrant.d.ts +91 -0
- package/dist/client/pairing/mirrorGrant.d.ts.map +1 -0
- package/dist/client/pairing/mirrorGrant.js +99 -0
- package/dist/client/pairing/mirrorGrant.js.map +1 -0
- package/dist/client/pairing/mirrorReader.d.ts +99 -0
- package/dist/client/pairing/mirrorReader.d.ts.map +1 -0
- package/dist/client/pairing/mirrorReader.js +117 -0
- package/dist/client/pairing/mirrorReader.js.map +1 -0
- package/dist/client/pairing/pairingGrantExchange.d.ts +135 -0
- package/dist/client/pairing/pairingGrantExchange.d.ts.map +1 -0
- package/dist/client/pairing/pairingGrantExchange.js +186 -0
- package/dist/client/pairing/pairingGrantExchange.js.map +1 -0
- package/dist/client/pairing/pairingRequest.d.ts +82 -0
- package/dist/client/pairing/pairingRequest.d.ts.map +1 -0
- package/dist/client/pairing/pairingRequest.js +120 -0
- package/dist/client/pairing/pairingRequest.js.map +1 -0
- package/dist/client/strategy.d.ts +36 -0
- package/dist/client/strategy.d.ts.map +1 -0
- package/dist/client/strategy.js +26 -0
- package/dist/client/strategy.js.map +1 -0
- package/dist/collections/index.d.ts +3 -0
- package/dist/collections/index.d.ts.map +1 -0
- package/dist/collections/index.js +3 -0
- package/dist/collections/index.js.map +1 -0
- package/dist/collections/nodeCollections.d.ts +57 -0
- package/dist/collections/nodeCollections.d.ts.map +1 -0
- package/dist/collections/nodeCollections.js +40 -0
- package/dist/collections/nodeCollections.js.map +1 -0
- package/dist/collections/paths.d.ts +7 -0
- package/dist/collections/paths.d.ts.map +1 -0
- package/dist/collections/paths.js +13 -0
- package/dist/collections/paths.js.map +1 -0
- package/dist/crypto/collectionKeys.d.ts +28 -0
- package/dist/crypto/collectionKeys.d.ts.map +1 -0
- package/dist/crypto/collectionKeys.js +53 -0
- package/dist/crypto/collectionKeys.js.map +1 -0
- package/dist/crypto/hkdf.d.ts +14 -0
- package/dist/crypto/hkdf.d.ts.map +1 -0
- package/dist/crypto/hkdf.js +19 -0
- package/dist/crypto/hkdf.js.map +1 -0
- package/dist/crypto/index.d.ts +5 -0
- package/dist/crypto/index.d.ts.map +1 -0
- package/dist/crypto/index.js +5 -0
- package/dist/crypto/index.js.map +1 -0
- package/dist/crypto/secretEncryptor.d.ts +20 -0
- package/dist/crypto/secretEncryptor.d.ts.map +1 -0
- package/dist/crypto/secretEncryptor.js +82 -0
- package/dist/crypto/secretEncryptor.js.map +1 -0
- package/dist/crypto/wireConstants.d.ts +14 -0
- package/dist/crypto/wireConstants.d.ts.map +1 -0
- package/dist/crypto/wireConstants.js +17 -0
- package/dist/crypto/wireConstants.js.map +1 -0
- package/dist/identity/address.d.ts +3 -0
- package/dist/identity/address.d.ts.map +1 -0
- package/dist/identity/address.js +17 -0
- package/dist/identity/address.js.map +1 -0
- package/dist/identity/bip39-wordlist.d.ts +2 -0
- package/dist/identity/bip39-wordlist.d.ts.map +1 -0
- package/dist/identity/bip39-wordlist.js +2051 -0
- package/dist/identity/bip39-wordlist.js.map +1 -0
- package/dist/identity/capProvider.d.ts +45 -0
- package/dist/identity/capProvider.d.ts.map +1 -0
- package/dist/identity/capProvider.js +80 -0
- package/dist/identity/capProvider.js.map +1 -0
- package/dist/identity/derivationSchemes.d.ts +25 -0
- package/dist/identity/derivationSchemes.d.ts.map +1 -0
- package/dist/identity/derivationSchemes.js +34 -0
- package/dist/identity/derivationSchemes.js.map +1 -0
- package/dist/identity/evm.d.ts +8 -0
- package/dist/identity/evm.d.ts.map +1 -0
- package/dist/identity/evm.js +78 -0
- package/dist/identity/evm.js.map +1 -0
- package/dist/identity/index.d.ts +10 -0
- package/dist/identity/index.d.ts.map +1 -0
- package/dist/identity/index.js +10 -0
- package/dist/identity/index.js.map +1 -0
- package/dist/identity/keys.d.ts +17 -0
- package/dist/identity/keys.d.ts.map +1 -0
- package/dist/identity/keys.js +36 -0
- package/dist/identity/keys.js.map +1 -0
- package/dist/identity/mnemonic.d.ts +4 -0
- package/dist/identity/mnemonic.d.ts.map +1 -0
- package/dist/identity/mnemonic.js +93 -0
- package/dist/identity/mnemonic.js.map +1 -0
- package/dist/identity/pairing.d.ts +45 -0
- package/dist/identity/pairing.d.ts.map +1 -0
- package/dist/identity/pairing.js +91 -0
- package/dist/identity/pairing.js.map +1 -0
- package/dist/identity/pairingRequest.d.ts +99 -0
- package/dist/identity/pairingRequest.d.ts.map +1 -0
- package/dist/identity/pairingRequest.js +217 -0
- package/dist/identity/pairingRequest.js.map +1 -0
- package/dist/identity/secret.d.ts +32 -0
- package/dist/identity/secret.d.ts.map +1 -0
- package/dist/identity/secret.js +54 -0
- package/dist/identity/secret.js.map +1 -0
- package/dist/index.d.ts +9 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +18 -0
- package/dist/index.js.map +1 -0
- package/dist/internal/bytes.d.ts +11 -0
- package/dist/internal/bytes.d.ts.map +1 -0
- package/dist/internal/bytes.js +38 -0
- package/dist/internal/bytes.js.map +1 -0
- package/dist/node-api/dexPair.d.ts +24 -0
- package/dist/node-api/dexPair.d.ts.map +1 -0
- package/dist/node-api/dexPair.js +39 -0
- package/dist/node-api/dexPair.js.map +1 -0
- package/dist/node-api/dsl.d.ts +10 -0
- package/dist/node-api/dsl.d.ts.map +1 -0
- package/dist/node-api/dsl.js +7 -0
- package/dist/node-api/dsl.js.map +1 -0
- package/dist/node-api/exchanges.d.ts +49 -0
- package/dist/node-api/exchanges.d.ts.map +1 -0
- package/dist/node-api/exchanges.js +32 -0
- package/dist/node-api/exchanges.js.map +1 -0
- package/dist/node-api/index.d.ts +12 -0
- package/dist/node-api/index.d.ts.map +1 -0
- package/dist/node-api/index.js +12 -0
- package/dist/node-api/index.js.map +1 -0
- package/dist/node-api/marketMaking.d.ts +39 -0
- package/dist/node-api/marketMaking.d.ts.map +1 -0
- package/dist/node-api/marketMaking.js +44 -0
- package/dist/node-api/marketMaking.js.map +1 -0
- package/dist/node-api/octobots.d.ts +14 -0
- package/dist/node-api/octobots.d.ts.map +1 -0
- package/dist/node-api/octobots.js +16 -0
- package/dist/node-api/octobots.js.map +1 -0
- package/dist/node-api/orderBookPreview.d.ts +11 -0
- package/dist/node-api/orderBookPreview.d.ts.map +1 -0
- package/dist/node-api/orderBookPreview.js +7 -0
- package/dist/node-api/orderBookPreview.js.map +1 -0
- package/dist/node-api/pairing.d.ts +39 -0
- package/dist/node-api/pairing.d.ts.map +1 -0
- package/dist/node-api/pairing.js +61 -0
- package/dist/node-api/pairing.js.map +1 -0
- package/dist/node-api/pairs.d.ts +32 -0
- package/dist/node-api/pairs.d.ts.map +1 -0
- package/dist/node-api/pairs.js +72 -0
- package/dist/node-api/pairs.js.map +1 -0
- package/dist/node-api/requiredFunds.d.ts +11 -0
- package/dist/node-api/requiredFunds.d.ts.map +1 -0
- package/dist/node-api/requiredFunds.js +7 -0
- package/dist/node-api/requiredFunds.js.map +1 -0
- package/dist/node-api/setup.d.ts +25 -0
- package/dist/node-api/setup.d.ts.map +1 -0
- package/dist/node-api/setup.js +13 -0
- package/dist/node-api/setup.js.map +1 -0
- package/dist/node-api/wallet.d.ts +55 -0
- package/dist/node-api/wallet.d.ts.map +1 -0
- package/dist/node-api/wallet.js +87 -0
- package/dist/node-api/wallet.js.map +1 -0
- package/dist/protocol/actions.d.ts +40 -0
- package/dist/protocol/actions.d.ts.map +1 -0
- package/dist/protocol/actions.js +118 -0
- package/dist/protocol/actions.js.map +1 -0
- package/dist/protocol/documents.d.ts +25 -0
- package/dist/protocol/documents.d.ts.map +1 -0
- package/dist/protocol/documents.js +2 -0
- package/dist/protocol/documents.js.map +1 -0
- package/dist/protocol/index.d.ts +10 -0
- package/dist/protocol/index.d.ts.map +1 -0
- package/dist/protocol/index.js +12 -0
- package/dist/protocol/index.js.map +1 -0
- package/dist/protocol/orchestration/createAutomation.d.ts +61 -0
- package/dist/protocol/orchestration/createAutomation.d.ts.map +1 -0
- package/dist/protocol/orchestration/createAutomation.js +71 -0
- package/dist/protocol/orchestration/createAutomation.js.map +1 -0
- package/dist/protocol/poll.d.ts +4 -0
- package/dist/protocol/poll.d.ts.map +1 -0
- package/dist/protocol/poll.js +4 -0
- package/dist/protocol/poll.js.map +1 -0
- package/dist/protocol/proposal.d.ts +36 -0
- package/dist/protocol/proposal.d.ts.map +1 -0
- package/dist/protocol/proposal.js +39 -0
- package/dist/protocol/proposal.js.map +1 -0
- package/dist/protocol/state.d.ts +87 -0
- package/dist/protocol/state.d.ts.map +1 -0
- package/dist/protocol/state.js +303 -0
- package/dist/protocol/state.js.map +1 -0
- package/dist/protocol/strategy/build.d.ts +44 -0
- package/dist/protocol/strategy/build.d.ts.map +1 -0
- package/dist/protocol/strategy/build.js +50 -0
- package/dist/protocol/strategy/build.js.map +1 -0
- package/dist/protocol/strategy/builders.d.ts +252 -0
- package/dist/protocol/strategy/builders.d.ts.map +1 -0
- package/dist/protocol/strategy/builders.js +382 -0
- package/dist/protocol/strategy/builders.js.map +1 -0
- package/dist/protocol/strategy/index.d.ts +5 -0
- package/dist/protocol/strategy/index.d.ts.map +1 -0
- package/dist/protocol/strategy/index.js +4 -0
- package/dist/protocol/strategy/index.js.map +1 -0
- package/dist/protocol/strategy/kinds.d.ts +2 -0
- package/dist/protocol/strategy/kinds.d.ts.map +1 -0
- package/dist/protocol/strategy/kinds.js +2 -0
- package/dist/protocol/strategy/kinds.js.map +1 -0
- package/dist/protocol/strategy/patch.d.ts +59 -0
- package/dist/protocol/strategy/patch.d.ts.map +1 -0
- package/dist/protocol/strategy/patch.js +253 -0
- package/dist/protocol/strategy/patch.js.map +1 -0
- package/dist/protocol/symbols.d.ts +8 -0
- package/dist/protocol/symbols.d.ts.map +1 -0
- package/dist/protocol/symbols.js +11 -0
- package/dist/protocol/symbols.js.map +1 -0
- package/dist/transport/constants.d.ts +8 -0
- package/dist/transport/constants.d.ts.map +1 -0
- package/dist/transport/constants.js +8 -0
- package/dist/transport/constants.js.map +1 -0
- package/dist/transport/documents.d.ts +27 -0
- package/dist/transport/documents.d.ts.map +1 -0
- package/dist/transport/documents.js +34 -0
- package/dist/transport/documents.js.map +1 -0
- package/dist/transport/index.d.ts +8 -0
- package/dist/transport/index.d.ts.map +1 -0
- package/dist/transport/index.js +8 -0
- package/dist/transport/index.js.map +1 -0
- package/dist/transport/probe.d.ts +44 -0
- package/dist/transport/probe.d.ts.map +1 -0
- package/dist/transport/probe.js +121 -0
- package/dist/transport/probe.js.map +1 -0
- package/dist/transport/rendezvous.d.ts +116 -0
- package/dist/transport/rendezvous.d.ts.map +1 -0
- package/dist/transport/rendezvous.js +139 -0
- package/dist/transport/rendezvous.js.map +1 -0
- package/dist/transport/rest.d.ts +35 -0
- package/dist/transport/rest.d.ts.map +1 -0
- package/dist/transport/rest.js +58 -0
- package/dist/transport/rest.js.map +1 -0
- package/dist/transport/syncClient.d.ts +14 -0
- package/dist/transport/syncClient.d.ts.map +1 -0
- package/dist/transport/syncClient.js +30 -0
- package/dist/transport/syncClient.js.map +1 -0
- package/dist/transport/urls.d.ts +35 -0
- package/dist/transport/urls.d.ts.map +1 -0
- package/dist/transport/urls.js +126 -0
- package/dist/transport/urls.js.map +1 -0
- package/package.json +55 -0
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
// Small hex/byte helpers shared across the package. Previously duplicated
|
|
2
|
+
// verbatim across auth/cap-provider.ts, auth/auth-core.ts and other files in
|
|
3
|
+
// @drakkar.software/octobot-sdk — consolidated here during the extraction.
|
|
4
|
+
// Zero dependencies by design (tier 0): every other tier may import this.
|
|
5
|
+
export function toHex(b) {
|
|
6
|
+
return Array.from(b, (x) => x.toString(16).padStart(2, '0')).join('');
|
|
7
|
+
}
|
|
8
|
+
export function hexToBytes(hex) {
|
|
9
|
+
const h = hex.startsWith('0x') ? hex.slice(2) : hex;
|
|
10
|
+
const out = new Uint8Array(h.length / 2);
|
|
11
|
+
for (let i = 0; i < out.length; i++)
|
|
12
|
+
out[i] = parseInt(h.slice(i * 2, i * 2 + 2), 16);
|
|
13
|
+
return out;
|
|
14
|
+
}
|
|
15
|
+
export function toBase64(bytes) {
|
|
16
|
+
return btoa(Array.from(bytes, (b) => String.fromCharCode(b)).join(''));
|
|
17
|
+
}
|
|
18
|
+
export function fromBase64(b64) {
|
|
19
|
+
const binary = atob(b64);
|
|
20
|
+
const buf = new ArrayBuffer(binary.length);
|
|
21
|
+
const bytes = new Uint8Array(buf);
|
|
22
|
+
for (let i = 0; i < binary.length; i++)
|
|
23
|
+
bytes[i] = binary.charCodeAt(i);
|
|
24
|
+
return bytes;
|
|
25
|
+
}
|
|
26
|
+
/** URL-safe base64 (`+/` → `-_`, no `=` padding) of raw bytes. Distinct from
|
|
27
|
+
* `starfish-protocol`'s `toBase64Url`, which encodes a UTF-8 *string* — not
|
|
28
|
+
* usable here since not every byte sequence (e.g. random session-id bytes)
|
|
29
|
+
* round-trips through UTF-8. */
|
|
30
|
+
export function toBase64Url(bytes) {
|
|
31
|
+
return toBase64(bytes).replace(/\+/g, '-').replace(/\//g, '_').replace(/=+$/, '');
|
|
32
|
+
}
|
|
33
|
+
export function fromBase64Url(b64url) {
|
|
34
|
+
const padded = b64url.replace(/-/g, '+').replace(/_/g, '/');
|
|
35
|
+
const padding = padded.length % 4 === 0 ? '' : '='.repeat(4 - (padded.length % 4));
|
|
36
|
+
return fromBase64(padded + padding);
|
|
37
|
+
}
|
|
38
|
+
//# sourceMappingURL=bytes.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bytes.js","sourceRoot":"","sources":["../../src/internal/bytes.ts"],"names":[],"mappings":"AAAA,0EAA0E;AAC1E,6EAA6E;AAC7E,2EAA2E;AAC3E,0EAA0E;AAE1E,MAAM,UAAU,KAAK,CAAC,CAAa;IACjC,OAAO,KAAK,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,CAAA;AACvE,CAAC;AAED,MAAM,UAAU,UAAU,CAAC,GAAW;IACpC,MAAM,CAAC,GAAG,GAAG,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAA;IACnD,MAAM,GAAG,GAAG,IAAI,UAAU,CAAC,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC,CAAA;IACxC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,GAAG,CAAC,MAAM,EAAE,CAAC,EAAE;QAAE,GAAG,CAAC,CAAC,CAAC,GAAG,QAAQ,CAAC,C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G,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAA;IAClF,OAAO,UAAU,CAAC,MAAM,GAAG,OAAO,CAAC,CAAA;AACrC,CAAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/** Reference-price-only exchange (no traded-pairs list) supported today.
|
|
2
|
+
* A future second source becomes a small ordered list, mirroring `PAIR_SOURCES`
|
|
3
|
+
* in `pairs.ts` — not needed yet for exactly one. */
|
|
4
|
+
export declare const DEX_REFERENCE_EXCHANGE_ID = "dexscreener";
|
|
5
|
+
export declare const DEX_PAIR_EXAMPLE = "WETH/USDT@BASE!PANCAKESWAP";
|
|
6
|
+
export declare const DEX_PAIR_FORMAT = "BASE/QUOTE@NETWORK!DEX";
|
|
7
|
+
export declare const DEX_PAIR_REGEX: RegExp;
|
|
8
|
+
export type ParsedDexPair = {
|
|
9
|
+
base: string;
|
|
10
|
+
quote: string;
|
|
11
|
+
network: string;
|
|
12
|
+
dex?: string;
|
|
13
|
+
};
|
|
14
|
+
export declare function parseDexPair(raw: string): ParsedDexPair | undefined;
|
|
15
|
+
export declare function isValidDexPair(raw: string): boolean;
|
|
16
|
+
export type DexPairSegments = {
|
|
17
|
+
pair: string;
|
|
18
|
+
network: string;
|
|
19
|
+
dex: string;
|
|
20
|
+
};
|
|
21
|
+
export declare function splitDexPairSegments(raw: string): DexPairSegments;
|
|
22
|
+
export declare function isValidDexPairSegment(segment: string): boolean;
|
|
23
|
+
export declare function isValidDexNameSegment(segment: string): boolean;
|
|
24
|
+
//# sourceMappingURL=dexPair.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dexPair.d.ts","sourceRoot":"","sources":["../../src/node-api/dexPair.ts"],"names":[],"mappings":"AAAA;;sDAEsD;AACtD,eAAO,MAAM,yBAAyB,gBAAgB,CAAA;AAEtD,eAAO,MAAM,gBAAgB,+BAA+B,CAAA;AAC5D,eAAO,MAAM,eAAe,2BAA2B,CAAA;AAIvD,eAAO,MAAM,cAAc,QACgC,CAAA;AAE3D,MAAM,MAAM,aAAa,GAAG;IAC1B,IAAI,EAAE,MAAM,CAAA;IACZ,KAAK,EAAE,MAAM,CAAA;IACb,OAAO,EAAE,MAAM,CAAA;IACf,GAAG,CAAC,EAAE,MAAM,CAAA;CACb,CAAA;AAED,wBAAgB,YAAY,CAAC,GAAG,EAAE,MAAM,GAAG,aAAa,GAAG,SAAS,CAOnE;AAED,wBAAgB,cAAc,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAEnD;AAID,MAAM,MAAM,eAAe,GAAG;IAC5B,IAAI,EAAE,MAAM,CAAA;IACZ,OAAO,EAAE,MAAM,CAAA;IACf,GAAG,EAAE,MAAM,CAAA;CACZ,CAAA;AAKD,wBAAgB,oBAAoB,CAAC,GAAG,EAAE,MAAM,GAAG,eAAe,CASjE;AAED,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAE9D;AAED,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAE9D"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/** Reference-price-only exchange (no traded-pairs list) supported today.
|
|
2
|
+
* A future second source becomes a small ordered list, mirroring `PAIR_SOURCES`
|
|
3
|
+
* in `pairs.ts` — not needed yet for exactly one. */
|
|
4
|
+
export const DEX_REFERENCE_EXCHANGE_ID = 'dexscreener';
|
|
5
|
+
export const DEX_PAIR_EXAMPLE = 'WETH/USDT@BASE!PANCAKESWAP';
|
|
6
|
+
export const DEX_PAIR_FORMAT = 'BASE/QUOTE@NETWORK!DEX';
|
|
7
|
+
// Dexscreener pair identifier: base/quote@network required, !dex optional.
|
|
8
|
+
// Segments accept tickers and contract addresses (no whitespace, '/', '@' or '!').
|
|
9
|
+
export const DEX_PAIR_REGEX = /^([^\s/@!]+)\/([^\s/@!]+)@([^\s/@!]+)(?:!([^\s/@!]+))?$/;
|
|
10
|
+
export function parseDexPair(raw) {
|
|
11
|
+
const match = DEX_PAIR_REGEX.exec(raw.trim());
|
|
12
|
+
if (!match) {
|
|
13
|
+
return undefined;
|
|
14
|
+
}
|
|
15
|
+
const [, base, quote, network, dex] = match;
|
|
16
|
+
return { base, quote, network, dex };
|
|
17
|
+
}
|
|
18
|
+
export function isValidDexPair(raw) {
|
|
19
|
+
return parseDexPair(raw) != undefined;
|
|
20
|
+
}
|
|
21
|
+
const PAIR_SEGMENT_REGEX = /^[^\s/@!]+\/[^\s/@!]+$/;
|
|
22
|
+
const NAME_SEGMENT_REGEX = /^[^\s/@!]+$/;
|
|
23
|
+
export function splitDexPairSegments(raw) {
|
|
24
|
+
const trimmed = raw.trim();
|
|
25
|
+
const atIndex = trimmed.indexOf('@');
|
|
26
|
+
const pair = atIndex >= 0 ? trimmed.slice(0, atIndex) : trimmed;
|
|
27
|
+
const rest = atIndex >= 0 ? trimmed.slice(atIndex + 1) : '';
|
|
28
|
+
const bangIndex = rest.indexOf('!');
|
|
29
|
+
const network = bangIndex >= 0 ? rest.slice(0, bangIndex) : rest;
|
|
30
|
+
const dex = bangIndex >= 0 ? rest.slice(bangIndex + 1) : '';
|
|
31
|
+
return { pair, network, dex };
|
|
32
|
+
}
|
|
33
|
+
export function isValidDexPairSegment(segment) {
|
|
34
|
+
return PAIR_SEGMENT_REGEX.test(segment);
|
|
35
|
+
}
|
|
36
|
+
export function isValidDexNameSegment(segment) {
|
|
37
|
+
return NAME_SEGMENT_REGEX.test(segment);
|
|
38
|
+
}
|
|
39
|
+
//# sourceMappingURL=dexPair.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dexPair.js","sourceRoot":"","sources":["../../src/node-api/dexPair.ts"],"names":[],"mappings":"AAAA;;sDAEsD;AACtD,MAAM,CAAC,MAAM,yBAAyB,GAAG,aAAa,CAAA;AA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C,CAAA;IACnC,MAAM,OAAO,GAAG,SAAS,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,SAAS,CAAC,CAAC,CAAC,CAAC,IAAI,CAAA;IAChE,MAAM,GAAG,GAAG,SAAS,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,SAAS,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAA;IAC3D,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,GAAG,EAAE,CAAA;AAC/B,CAAC;AAED,MAAM,UAAU,qBAAqB,CAAC,OAAe;IACnD,OAAO,kBAAkB,CAAC,IAAI,CAAC,OAAO,CAAC,CAAA;AACzC,CAAC;AAED,MAAM,UAAU,qBAAqB,CAAC,OAAe;IACnD,OAAO,kBAAkB,CAAC,IAAI,CAAC,OAAO,CAAC,CAAA;AACzC,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { DslKeywordsState } from '@drakkar.software/octobot-protocol';
|
|
2
|
+
import type { NodeEndpoint } from '../transport/urls.js';
|
|
3
|
+
import { type NodeCredentials } from '../transport/rest.js';
|
|
4
|
+
/** `GET /api/v1/dsl/keywords` — the DSL keywords this node can run, with the
|
|
5
|
+
* state version they were authored against. Authenticated. */
|
|
6
|
+
export declare function fetchNodeDslKeywords(node: NodeEndpoint, credentials: NodeCredentials, options?: {
|
|
7
|
+
signal?: AbortSignal;
|
|
8
|
+
fetch?: typeof fetch;
|
|
9
|
+
}): Promise<DslKeywordsState>;
|
|
10
|
+
//# sourceMappingURL=dsl.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dsl.d.ts","sourceRoot":"","sources":["../../src/node-api/dsl.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,oCAAoC,CAAA;AAC1E,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAA;AACxD,OAAO,EAAmB,KAAK,eAAe,EAAE,MAAM,sBAAsB,CAAA;AAE5E;+DAC+D;AAC/D,wBAAsB,oBAAoB,CACxC,IAAI,EAAE,YAAY,EAClB,WAAW,EAAE,eAAe,EAC5B,OAAO,GAAE;IAAE,MAAM,CAAC,EAAE,WAAW,CAAC;IAAC,KAAK,CAAC,EAAE,OAAO,KAAK,CAAA;CAAO,GAC3D,OAAO,CAAC,gBAAgB,CAAC,CAE3B"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { nodeAuthRequest } from '../transport/rest.js';
|
|
2
|
+
/** `GET /api/v1/dsl/keywords` — the DSL keywords this node can run, with the
|
|
3
|
+
* state version they were authored against. Authenticated. */
|
|
4
|
+
export async function fetchNodeDslKeywords(node, credentials, options = {}) {
|
|
5
|
+
return nodeAuthRequest(node, credentials, '/dsl/keywords', options);
|
|
6
|
+
}
|
|
7
|
+
//# sourceMappingURL=dsl.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dsl.js","sourceRoot":"","sources":["../../src/node-api/dsl.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,eAAe,EAAwB,MAAM,sBAAsB,CAAA;AAE5E;+DAC+D;AAC/D,MAAM,CAAC,KAAK,UAAU,oBAAoB,CACxC,IAAkB,EAClB,WAA4B,EAC5B,UAA0D,EAAE;IAE5D,OAAO,eAAe,CAAmB,IAAI,EAAE,WAAW,EAAE,eAAe,EAAE,OAAO,CAAC,CAAA;AACvF,CAAC"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import type { TradedPairVolume } from '@drakkar.software/octobot-protocol';
|
|
2
|
+
import type { NodeEndpoint } from '../transport/urls.js';
|
|
3
|
+
import { nodeBaseUrl } from '../transport/urls.js';
|
|
4
|
+
export type { TradedPairVolume };
|
|
5
|
+
/** Mirrors the FastAPI `ExchangeConfig` pydantic model on the node side
|
|
6
|
+
* (packages/tentacles/.../node_api_interface/core/exchanges.py). `id` and
|
|
7
|
+
* `name` are required by the node's query schema but not read by the
|
|
8
|
+
* traded-pairs lookup itself (only `exchange`/`sandboxed`/`url` are) — any
|
|
9
|
+
* stable non-empty string works for them. */
|
|
10
|
+
export type ExchangeConfigParams = {
|
|
11
|
+
id: string;
|
|
12
|
+
name: string;
|
|
13
|
+
/** Exchange identifier used to build the node's exchange client, e.g. "binance". Required. */
|
|
14
|
+
exchange: string;
|
|
15
|
+
sandboxed?: boolean;
|
|
16
|
+
url?: string;
|
|
17
|
+
};
|
|
18
|
+
/** One exchange's `traded-pairs` entry: symbol → volume. The volume object is
|
|
19
|
+
* empty unless the request asked for `with_volume`. */
|
|
20
|
+
export type TradedPairsForExchange = Record<string, TradedPairVolume>;
|
|
21
|
+
/** Per-exchange `traded-pairs` payload: keyed by exchange internal name. */
|
|
22
|
+
export type TradedPairsByExchange = Record<string, TradedPairsForExchange>;
|
|
23
|
+
/** Shape returned by nodes older than the `TradedPairsByExchange` protocol
|
|
24
|
+
* change (a bare symbol list per exchange). Users run their own nodes, so
|
|
25
|
+
* both shapes have to be readable — see `extractPairs` in ./pairs.ts. */
|
|
26
|
+
export type LegacyTradedPairsByExchange = Record<string, string[]>;
|
|
27
|
+
/** Per-exchange `traded-pairs-and-timeframes` payload. */
|
|
28
|
+
export type TradedPairsAndTimeframesByExchange = Record<string, {
|
|
29
|
+
pairs: string[];
|
|
30
|
+
timeframes: string[];
|
|
31
|
+
}>;
|
|
32
|
+
/** `GET /api/v1/exchanges/traded-pairs?name=<id>&...`
|
|
33
|
+
* Response: `{ [exchangeInternalName]: { [symbol]: { baseVolume?, quoteVolume? } } }`
|
|
34
|
+
* (older nodes: `{ [exchangeInternalName]: string[] }`).
|
|
35
|
+
* `withVolume` asks the node to fill the volumes from the exchange tickers —
|
|
36
|
+
* it answers 501 when that exchange doesn't support the lookup. */
|
|
37
|
+
export declare function fetchNodeTradedPairs(node: NodeEndpoint, exchange: ExchangeConfigParams, options?: {
|
|
38
|
+
withVolume?: boolean;
|
|
39
|
+
signal?: AbortSignal;
|
|
40
|
+
fetch?: typeof fetch;
|
|
41
|
+
}): Promise<TradedPairsByExchange | LegacyTradedPairsByExchange>;
|
|
42
|
+
/** `GET /api/v1/exchanges/traded-pairs-and-timeframes?name=<id>&...`
|
|
43
|
+
* Response: `{ [exchangeInternalName]: { pairs: string[]; timeframes: string[] } }`. */
|
|
44
|
+
export declare function fetchNodeTradedPairsAndTimeframes(node: NodeEndpoint, exchange: ExchangeConfigParams, options?: {
|
|
45
|
+
signal?: AbortSignal;
|
|
46
|
+
fetch?: typeof fetch;
|
|
47
|
+
}): Promise<TradedPairsAndTimeframesByExchange>;
|
|
48
|
+
export { nodeBaseUrl };
|
|
49
|
+
//# sourceMappingURL=exchanges.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"exchanges.d.ts","sourceRoot":"","sources":["../../src/node-api/exchanges.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,oCAAoC,CAAA;AAC1E,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAA;AACxD,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAA;AAGlD,YAAY,EAAE,gBAAgB,EAAE,CAAA;AAEhC;;;;8CAI8C;AAC9C,MAAM,MAAM,oBAAoB,GAAG;IACjC,EAAE,EAAE,MAAM,CAAA;IACV,IAAI,EAAE,MAAM,CAAA;IACZ,8FAA8F;IAC9F,QAAQ,EAAE,MAAM,CAAA;IAChB,SAAS,CAAC,EAAE,OAAO,CAAA;IACnB,GAAG,CAAC,EAAE,MAAM,CAAA;CACb,CAAA;AAED;wDACwD;AACxD,MAAM,MAAM,sBAAsB,GAAG,MAAM,CAAC,MAAM,EAAE,gBAAgB,CAAC,CAAA;AAErE,4EAA4E;AAC5E,MAAM,MAAM,qBAAqB,GAAG,MAAM,CAAC,MAAM,EAAE,sBAAsB,CAAC,CAAA;AAE1E;;0EAE0E;AAC1E,MAAM,MAAM,2BAA2B,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,CAAA;AAElE,0DAA0D;AAC1D,MAAM,MAAM,kCAAkC,GAAG,MAAM,CACrD,MAAM,EACN;IAAE,KAAK,EAAE,MAAM,EAAE,CAAC;IAAC,UAAU,EAAE,MAAM,EAAE,CAAA;CAAE,CAC1C,CAAA;AAYD;;;;oEAIoE;AACpE,wBAAsB,oBAAoB,CACxC,IAAI,EAAE,YAAY,EAClB,QAAQ,EAAE,oBAAoB,EAC9B,OAAO,GAAE;IAAE,UAAU,CAAC,EAAE,OAAO,CAAC;IAAC,MAAM,CAAC,EAAE,WAAW,CAAC;IAAC,KAAK,CAAC,EAAE,OAAO,KAAK,CAAA;CAAO,GACjF,OAAO,CAAC,qBAAqB,GAAG,2BAA2B,CAAC,CAQ9D;AAED;yFACyF;AACzF,wBAAsB,iCAAiC,CACrD,IAAI,EAAE,YAAY,EAClB,QAAQ,EAAE,oBAAoB,EAC9B,OAAO,GAAE;IAAE,MAAM,CAAC,EAAE,WAAW,CAAC;IAAC,KAAK,CAAC,EAAE,OAAO,KAAK,CAAA;CAAO,GAC3D,OAAO,CAAC,kCAAkC,CAAC,CAM7C;AAID,OAAO,EAAE,WAAW,EAAE,CAAA"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { nodeBaseUrl } from '../transport/urls.js';
|
|
2
|
+
import { nodeRequest } from '../transport/rest.js';
|
|
3
|
+
function buildExchangeConfigQuery(params) {
|
|
4
|
+
const sp = new URLSearchParams();
|
|
5
|
+
sp.set('id', params.id);
|
|
6
|
+
sp.set('name', params.name);
|
|
7
|
+
sp.set('exchange', params.exchange);
|
|
8
|
+
if (params.sandboxed !== undefined)
|
|
9
|
+
sp.set('sandboxed', String(params.sandboxed));
|
|
10
|
+
if (params.url !== undefined)
|
|
11
|
+
sp.set('url', params.url);
|
|
12
|
+
return sp.toString();
|
|
13
|
+
}
|
|
14
|
+
/** `GET /api/v1/exchanges/traded-pairs?name=<id>&...`
|
|
15
|
+
* Response: `{ [exchangeInternalName]: { [symbol]: { baseVolume?, quoteVolume? } } }`
|
|
16
|
+
* (older nodes: `{ [exchangeInternalName]: string[] }`).
|
|
17
|
+
* `withVolume` asks the node to fill the volumes from the exchange tickers —
|
|
18
|
+
* it answers 501 when that exchange doesn't support the lookup. */
|
|
19
|
+
export async function fetchNodeTradedPairs(node, exchange, options = {}) {
|
|
20
|
+
const query = buildExchangeConfigQuery(exchange);
|
|
21
|
+
const volumeQuery = options.withVolume ? '&with_volume=true' : '';
|
|
22
|
+
return nodeRequest(node, `/exchanges/traded-pairs?${query}${volumeQuery}`, { signal: options.signal, fetch: options.fetch });
|
|
23
|
+
}
|
|
24
|
+
/** `GET /api/v1/exchanges/traded-pairs-and-timeframes?name=<id>&...`
|
|
25
|
+
* Response: `{ [exchangeInternalName]: { pairs: string[]; timeframes: string[] } }`. */
|
|
26
|
+
export async function fetchNodeTradedPairsAndTimeframes(node, exchange, options = {}) {
|
|
27
|
+
return nodeRequest(node, `/exchanges/traded-pairs-and-timeframes?${buildExchangeConfigQuery(exchange)}`, options);
|
|
28
|
+
}
|
|
29
|
+
// nodeBaseUrl re-export kept for callers that build their own custom requests
|
|
30
|
+
// against this same node.
|
|
31
|
+
export { nodeBaseUrl };
|
|
32
|
+
//# sourceMappingURL=exchanges.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"exchanges.js","sourceRoot":"","sources":["../../src/node-api/exchanges.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAA;AAClD,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAA;AAoClD,SAAS,wBAAwB,CAAC,MAA4B;IAC5D,MAAM,EAAE,GAAG,IAAI,eAAe,EAAE,CAAA;IAChC,EAAE,CAAC,GAAG,CAAC,IAAI,EAAE,MAAM,CAAC,EAAE,CAAC,CAAA;IACvB,EAAE,CAAC,GAAG,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ams, type TradedPairsForExchange, type TradedPairsByExchange, type LegacyTradedPairsByExchange, type TradedPairsAndTimeframesByExchange, type TradedPairVolume, } from './exchanges.js';
|
|
2
|
+
export { extractPairs, fetchPairsFromNode, type AutomationPair } from './pairs.js';
|
|
3
|
+
export { postMarketMakingRequest, marketMakingRequestBody, type PredictedOrderLevel, type PredictedOrderBookEntry, type PredictedOrderBookResponse, type RequiredFundsEntry, type RequiredFundsResponse, } from './marketMaking.js';
|
|
4
|
+
export { fetchPredictedOrderBook } from './orderBookPreview.js';
|
|
5
|
+
export { fetchRequiredFunds } from './requiredFunds.js';
|
|
6
|
+
export { fetchNodeDslKeywords } from './dsl.js';
|
|
7
|
+
export { createGenericProcessBot, type CreateGenericProcessBotResponse } from './octobots.js';
|
|
8
|
+
export { fetchNodeWalletExport, type NodeWalletExport } from './setup.js';
|
|
9
|
+
export { parseNodePairingQr, parsePairingHost, verifyNodeCredentials, type NodePairingPayload, type NodeCredentialCheck, } from './pairing.js';
|
|
10
|
+
export { nodeWalletFromSecret, nodeWalletFromExport, nodeWalletKey, classifyScannedCode, type NodeWalletImport, type ScannedCode, } from './wallet.js';
|
|
11
|
+
export { DEX_REFERENCE_EXCHANGE_ID, DEX_PAIR_EXAMPLE, DEX_PAIR_FORMAT, DEX_PAIR_REGEX, parseDexPair, isValidDexPair, splitDexPairSegments, isValidDexPairSegment, isValidDexNameSegment, type ParsedDexPair, type DexPairSegments, } from './dexPair.js';
|
|
12
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/node-api/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,oBAAoB,EACpB,iCAAiC,EACjC,KAAK,oBAAoB,EACzB,KAAK,sBAAsB,EAC3B,KAAK,qBAAqB,EAC1B,KAAK,2BAA2B,EAChC,KAAK,kCAAkC,EACvC,KAAK,gBAAgB,GACtB,MAAM,gBAAgB,CAAA;AACvB,OAAO,EAAE,YAAY,EAAE,kBAAkB,EAAE,KAAK,cAAc,EAAE,MAAM,YAAY,CAAA;AAClF,OAAO,EACL,uBAAuB,EACvB,uBAAuB,EACvB,KAAK,mBAAmB,EACxB,KAAK,uBAAuB,EAC5B,KAAK,0BAA0B,EAC/B,KAAK,kBAAkB,EACvB,KAAK,qBAAqB,GAC3B,MAAM,mBAAmB,CAAA;AAC1B,OAAO,EAAE,uBAAuB,EAAE,MAAM,uBAAuB,CAAA;AAC/D,OAAO,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAA;AACvD,OAAO,EAAE,oBAAoB,EAAE,MAAM,UAAU,CAAA;AAC/C,OAAO,EAAE,uBAAuB,EAAE,KAAK,+BAA+B,EAAE,MAAM,eAAe,CAAA;AAC7F,OAAO,EAAE,qBAAqB,EAAE,KAAK,gBAAgB,EAAE,MAAM,YAAY,CAAA;AACzE,OAAO,EACL,kBAAkB,EAClB,gBAAgB,EAChB,qBAAqB,EACrB,KAAK,kBAAkB,EACvB,KAAK,mBAAmB,GACzB,MAAM,cAAc,CAAA;AACrB,OAAO,EACL,oBAAoB,EACpB,oBAAoB,EACpB,aAAa,EACb,mBAAmB,EACnB,KAAK,gBAAgB,EACrB,KAAK,WAAW,GACjB,MAAM,aAAa,CAAA;AACpB,OAAO,EACL,yBAAyB,EACzB,gBAAgB,EAChB,eAAe,EACf,cAAc,EACd,YAAY,EACZ,cAAc,EACd,oBAAoB,EACpB,qBAAqB,EACrB,qBAAqB,EACrB,KAAK,aAAa,EAClB,KAAK,eAAe,GACrB,MAAM,cAAc,CAAA"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export { fetchNodeTradedPairs, fetchNodeTradedPairsAndTimeframes, } from './exchanges.js';
|
|
2
|
+
export { extractPairs, fetchPairsFromNode } from './pairs.js';
|
|
3
|
+
export { postMarketMakingRequest, marketMakingRequestBody, } from './marketMaking.js';
|
|
4
|
+
export { fetchPredictedOrderBook } from './orderBookPreview.js';
|
|
5
|
+
export { fetchRequiredFunds } from './requiredFunds.js';
|
|
6
|
+
export { fetchNodeDslKeywords } from './dsl.js';
|
|
7
|
+
export { createGenericProcessBot } from './octobots.js';
|
|
8
|
+
export { fetchNodeWalletExport } from './setup.js';
|
|
9
|
+
export { parseNodePairingQr, parsePairingHost, verifyNodeCredentials, } from './pairing.js';
|
|
10
|
+
export { nodeWalletFromSecret, nodeWalletFromExport, nodeWalletKey, classifyScannedCode, } from './wallet.js';
|
|
11
|
+
export { DEX_REFERENCE_EXCHANGE_ID, DEX_PAIR_EXAMPLE, DEX_PAIR_FORMAT, DEX_PAIR_REGEX, parseDexPair, isValidDexPair, splitDexPairSegments, isValidDexPairSegment, isValidDexNameSegment, } from './dexPair.js';
|
|
12
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/node-api/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,oBAAoB,EACpB,iCAAiC,GAOlC,MAAM,gBAAgB,CAAA;AACvB,OAAO,EAAE,YAAY,EAAE,kBAAkB,EAAuB,MAAM,YAAY,CAAA;AAClF,OAAO,EACL,uBAAuB,EACvB,uBAAuB,GAMxB,MAAM,mBAAmB,CAAA;AAC1B,OAAO,EAAE,uBAAuB,EAAE,MAAM,uBAAuB,CAAA;AAC/D,OAAO,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAA;AACvD,OAAO,EAAE,oBAAoB,EAAE,MAAM,UAAU,CAAA;AAC/C,OAAO,EAAE,uBAAuB,EAAwC,MAAM,eAAe,CAAA;AAC7F,OAAO,EAAE,qBAAqB,EAAyB,MAAM,YAAY,CAAA;AACzE,OAAO,EACL,kBAAkB,EAClB,gBAAgB,EAChB,qBAAqB,GAGtB,MAAM,cAAc,CAAA;AACrB,OAAO,EACL,oBAAoB,EACpB,oBAAoB,EACpB,aAAa,EACb,mBAAmB,GAGpB,MAAM,aAAa,CAAA;AACpB,OAAO,EACL,yBAAyB,EACzB,gBAAgB,EAChB,eAAe,EACf,cAAc,EACd,YAAY,EACZ,cAAc,EACd,oBAAoB,EACpB,qBAAqB,EACrB,qBAAqB,GAGtB,MAAM,cAAc,CAAA"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import type { MarketMakingConfiguration } from '@drakkar.software/octobot-protocol';
|
|
2
|
+
import type { NodeEndpoint } from '../transport/urls.js';
|
|
3
|
+
import type { ExchangeConfigParams } from './exchanges.js';
|
|
4
|
+
/** Per-symbol predicted order-book ladder level. */
|
|
5
|
+
export type PredictedOrderLevel = {
|
|
6
|
+
price: number;
|
|
7
|
+
amount: number;
|
|
8
|
+
total: number;
|
|
9
|
+
};
|
|
10
|
+
/** One pair's `predicted_order_book` result — `error` is set instead of the
|
|
11
|
+
* other fields when the node couldn't compute a preview for that pair
|
|
12
|
+
* (e.g. missing ticker, unsupported pair). */
|
|
13
|
+
export type PredictedOrderBookEntry = {
|
|
14
|
+
price: number | null;
|
|
15
|
+
bids: PredictedOrderLevel[] | null;
|
|
16
|
+
asks: PredictedOrderLevel[] | null;
|
|
17
|
+
volume: Record<string, number> | null;
|
|
18
|
+
error: string | null;
|
|
19
|
+
};
|
|
20
|
+
/** `{ [exchangeInternalName]: { [symbol]: PredictedOrderBookEntry } }`. */
|
|
21
|
+
export type PredictedOrderBookResponse = Record<string, Record<string, PredictedOrderBookEntry>>;
|
|
22
|
+
/** One pair's `market_making_volume` result — the minimal base/quote amounts
|
|
23
|
+
* needed to run the configured order-book distribution at the current
|
|
24
|
+
* reference price. */
|
|
25
|
+
export type RequiredFundsEntry = {
|
|
26
|
+
volume: Record<string, number> | null;
|
|
27
|
+
error: string | null;
|
|
28
|
+
};
|
|
29
|
+
/** `{ [exchangeInternalName]: { [symbol]: RequiredFundsEntry } }`. */
|
|
30
|
+
export type RequiredFundsResponse = Record<string, Record<string, RequiredFundsEntry>>;
|
|
31
|
+
/** POSTs to the node's single market-making dispatch route
|
|
32
|
+
* (`POST /api/v1/tentacles/market-making/`), which branches on `type`
|
|
33
|
+
* (`predicted_order_book`, `market_making_volume`, `update_liquidity_score`). */
|
|
34
|
+
export declare function postMarketMakingRequest<T>(node: NodeEndpoint, body: unknown, options?: {
|
|
35
|
+
signal?: AbortSignal;
|
|
36
|
+
fetch?: typeof fetch;
|
|
37
|
+
}): Promise<T>;
|
|
38
|
+
export declare function marketMakingRequestBody(type: 'predicted_order_book' | 'market_making_volume', exchange: ExchangeConfigParams, config: MarketMakingConfiguration): unknown;
|
|
39
|
+
//# sourceMappingURL=marketMaking.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"marketMaking.d.ts","sourceRoot":"","sources":["../../src/node-api/marketMaking.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,oCAAoC,CAAA;AACnF,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAA;AAIxD,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAA;AAE1D,oDAAoD;AACpD,MAAM,MAAM,mBAAmB,GAAG;IAChC,KAAK,EAAE,MAAM,CAAA;IACb,MAAM,EAAE,MAAM,CAAA;IACd,KAAK,EAAE,MAAM,CAAA;CACd,CAAA;AAED;;+CAE+C;AAC/C,MAAM,MAAM,uBAAuB,GAAG;IACpC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAA;IACpB,IAAI,EAAE,mBAAmB,EAAE,GAAG,IAAI,CAAA;IAClC,IAAI,EAAE,mBAAmB,EAAE,GAAG,IAAI,CAAA;IAClC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,IAAI,CAAA;IACrC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAA;CACrB,CAAA;AAED,2EAA2E;AAC3E,MAAM,MAAM,0BAA0B,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,uBAAuB,CAAC,CAAC,CAAA;AAEhG;;uBAEuB;AACvB,MAAM,MAAM,kBAAkB,GAAG;IAC/B,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,IAAI,CAAA;IACrC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAA;CACrB,CAAA;AAED,sEAAsE;AACtE,MAAM,MAAM,qBAAqB,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,kBAAkB,CAAC,CAAC,CAAA;AAEtF;;kFAEkF;AAClF,wBAAsB,uBAAuB,CAAC,CAAC,EAC7C,IAAI,EAAE,YAAY,EAClB,IAAI,EAAE,OAAO,EACb,OAAO,GAAE;IAAE,MAAM,CAAC,EAAE,WAAW,CAAC;IAAC,KAAK,CAAC,EAAE,OAAO,KAAK,CAAA;CAAO,GAC3D,OAAO,CAAC,CAAC,CAAC,CAoBZ;AAED,wBAAgB,uBAAuB,CACrC,IAAI,EAAE,sBAAsB,GAAG,sBAAsB,EACrD,QAAQ,EAAE,oBAAoB,EAC9B,MAAM,EAAE,yBAAyB,GAChC,OAAO,CAWT"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { nodeBaseUrl } from '../transport/urls.js';
|
|
2
|
+
import { NodeHttpError } from '../transport/rest.js';
|
|
3
|
+
import { MARKET_MAKING_TIMEOUT_MS } from '../transport/constants.js';
|
|
4
|
+
/** POSTs to the node's single market-making dispatch route
|
|
5
|
+
* (`POST /api/v1/tentacles/market-making/`), which branches on `type`
|
|
6
|
+
* (`predicted_order_book`, `market_making_volume`, `update_liquidity_score`). */
|
|
7
|
+
export async function postMarketMakingRequest(node, body, options = {}) {
|
|
8
|
+
const fetchImpl = options.fetch ?? globalThis.fetch;
|
|
9
|
+
const url = `${nodeBaseUrl(node)}/tentacles/market-making/`;
|
|
10
|
+
const internalController = new AbortController();
|
|
11
|
+
const timer = setTimeout(() => internalController.abort(), MARKET_MAKING_TIMEOUT_MS);
|
|
12
|
+
const onCallerAbort = () => internalController.abort();
|
|
13
|
+
if (options.signal)
|
|
14
|
+
options.signal.addEventListener('abort', onCallerAbort);
|
|
15
|
+
try {
|
|
16
|
+
const res = await fetchImpl(url, {
|
|
17
|
+
method: 'POST',
|
|
18
|
+
headers: { 'Content-Type': 'application/json' },
|
|
19
|
+
body: JSON.stringify(body),
|
|
20
|
+
signal: internalController.signal,
|
|
21
|
+
});
|
|
22
|
+
if (!res.ok)
|
|
23
|
+
throw new NodeHttpError(res.status);
|
|
24
|
+
return (await res.json());
|
|
25
|
+
}
|
|
26
|
+
finally {
|
|
27
|
+
clearTimeout(timer);
|
|
28
|
+
if (options.signal)
|
|
29
|
+
options.signal.removeEventListener('abort', onCallerAbort);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
export function marketMakingRequestBody(type, exchange, config) {
|
|
33
|
+
return {
|
|
34
|
+
type,
|
|
35
|
+
auth: null,
|
|
36
|
+
// Unlike the GET traded-pairs query (where an omitted `sandboxed` falls
|
|
37
|
+
// through to the FastAPI route's own `= False` default), this route's
|
|
38
|
+
// pydantic ExchangeConfig has no default for `sandboxed` — omitting it
|
|
39
|
+
// is a 422/validation error the node surfaces as a bare 404.
|
|
40
|
+
exchanges: [{ ...exchange, sandboxed: exchange.sandboxed ?? false }],
|
|
41
|
+
config: { config },
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
//# sourceMappingURL=marketMaking.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"marketMaking.js","sourceRoot":"","sources":["../../src/node-api/marketMaking.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAA;AAClD,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAA;AACpD,OAAO,EAAE,wBAAwB,EAAE,MAAM,2BAA2B,CAAA;AAmCpE;;kFAEkF;AAClF,MAAM,CAAC,KAAK,UAAU,uBAAuB,CAC3C,IAAkB,EAClB,IAAa,EACb,UAA0D,EAAE;I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AuE;QACvE,6DAA6D;QAC7D,SAAS,EAAE,CAAC,EAAE,GAAG,QAAQ,EAAE,SAAS,EAAE,QAAQ,CAAC,SAAS,IAAI,KAAK,EAAE,CAAC;QACpE,MAAM,EAAE,EAAE,MAAM,EAAE;KACnB,CAAA;AACH,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { NodeEndpoint } from '../transport/urls.js';
|
|
2
|
+
import { type NodeCredentials } from '../transport/rest.js';
|
|
3
|
+
export type CreateGenericProcessBotResponse = {
|
|
4
|
+
automation_id: string;
|
|
5
|
+
};
|
|
6
|
+
/** `POST /api/v1/octobots/generic-process` — start a full OctoBot process bot
|
|
7
|
+
* on the node. Authenticated. Answers 201 with the new automation id; 400 on
|
|
8
|
+
* an empty/invalid name, 503 when the node's scheduler isn't up, 504 when the
|
|
9
|
+
* creation workflow times out (all surfaced as `NodeHttpError`). */
|
|
10
|
+
export declare function createGenericProcessBot(node: NodeEndpoint, credentials: NodeCredentials, name: string, options?: {
|
|
11
|
+
signal?: AbortSignal;
|
|
12
|
+
fetch?: typeof fetch;
|
|
13
|
+
}): Promise<CreateGenericProcessBotResponse>;
|
|
14
|
+
//# sourceMappingURL=octobots.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"octobots.d.ts","sourceRoot":"","sources":["../../src/node-api/octobots.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAA;AACxD,OAAO,EAAmB,KAAK,eAAe,EAAE,MAAM,sBAAsB,CAAA;AAG5E,MAAM,MAAM,+BAA+B,GAAG;IAAE,aAAa,EAAE,MAAM,CAAA;CAAE,CAAA;AAEvE;;;qEAGqE;AACrE,wBAAsB,uBAAuB,CAC3C,IAAI,EAAE,YAAY,EAClB,WAAW,EAAE,eAAe,EAC5B,IAAI,EAAE,MAAM,EACZ,OAAO,GAAE;IAAE,MAAM,CAAC,EAAE,WAAW,CAAC;IAAC,KAAK,CAAC,EAAE,OAAO,KAAK,CAAA;CAAO,GAC3D,OAAO,CAAC,+BAA+B,CAAC,CAQ1C"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { nodeAuthRequest } from '../transport/rest.js';
|
|
2
|
+
import { CREATE_GENERIC_PROCESS_TIMEOUT_MS } from '../transport/constants.js';
|
|
3
|
+
/** `POST /api/v1/octobots/generic-process` — start a full OctoBot process bot
|
|
4
|
+
* on the node. Authenticated. Answers 201 with the new automation id; 400 on
|
|
5
|
+
* an empty/invalid name, 503 when the node's scheduler isn't up, 504 when the
|
|
6
|
+
* creation workflow times out (all surfaced as `NodeHttpError`). */
|
|
7
|
+
export async function createGenericProcessBot(node, credentials, name, options = {}) {
|
|
8
|
+
return nodeAuthRequest(node, credentials, '/octobots/generic-process', {
|
|
9
|
+
method: 'POST',
|
|
10
|
+
body: { name },
|
|
11
|
+
signal: options.signal,
|
|
12
|
+
fetch: options.fetch,
|
|
13
|
+
timeoutMs: CREATE_GENERIC_PROCESS_TIMEOUT_MS,
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=octobots.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"octobots.js","sourceRoot":"","sources":["../../src/node-api/octobots.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAwB,MAAM,sBAAsB,CAAA;AAC5E,OAAO,EAAE,iCAAiC,EAAE,MAAM,2BAA2B,CAAA;AAI7E;;;qEAGqE;AACrE,MAAM,CAAC,KAAK,UAAU,uBAAuB,CAC3C,IAAkB,EAClB,WAA4B,EAC5B,IAAY,EACZ,UAA0D,EAAE;IAE5D,OAAO,eAAe,CAAkC,IAAI,EAAE,WAAW,EAAE,2BAA2B,EAAE;QACtG,MAAM,EAAE,MAAM;QACd,IAAI,EAAE,EAAE,IAAI,EAAE;QACd,MAAM,EAAE,OAAO,CAAC,MAAM;QACtB,KAAK,EAAE,OAAO,CAAC,KAAK;QACpB,SAAS,EAAE,iCAAiC;KAC7C,CAAC,CAAA;AACJ,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { MarketMakingConfiguration } from '@drakkar.software/octobot-protocol';
|
|
2
|
+
import type { NodeEndpoint } from '../transport/urls.js';
|
|
3
|
+
import type { ExchangeConfigParams } from './exchanges.js';
|
|
4
|
+
import { type PredictedOrderBookResponse } from './marketMaking.js';
|
|
5
|
+
export type { PredictedOrderBookResponse };
|
|
6
|
+
/** `POST /api/v1/tentacles/market-making/` with `type: 'predicted_order_book'`. */
|
|
7
|
+
export declare function fetchPredictedOrderBook(node: NodeEndpoint, exchangeConfig: ExchangeConfigParams, marketMakingConfig: MarketMakingConfiguration, options?: {
|
|
8
|
+
signal?: AbortSignal;
|
|
9
|
+
fetch?: typeof fetch;
|
|
10
|
+
}): Promise<PredictedOrderBookResponse>;
|
|
11
|
+
//# sourceMappingURL=orderBookPreview.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"orderBookPreview.d.ts","sourceRoot":"","sources":["../../src/node-api/orderBookPreview.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,oCAAoC,CAAA;AACnF,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAA;AACxD,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAA;AAC1D,OAAO,EAAoD,KAAK,0BAA0B,EAAE,MAAM,mBAAmB,CAAA;AAErH,YAAY,EAAE,0BAA0B,EAAE,CAAA;AAE1C,mFAAmF;AACnF,wBAAsB,uBAAuB,CAC3C,IAAI,EAAE,YAAY,EAClB,cAAc,EAAE,oBAAoB,EACpC,kBAAkB,EAAE,yBAAyB,EAC7C,OAAO,GAAE;IAAE,MAAM,CAAC,EAAE,WAAW,CAAC;IAAC,KAAK,CAAC,EAAE,OAAO,KAAK,CAAA;CAAO,GAC3D,OAAO,CAAC,0BAA0B,CAAC,CAGrC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { marketMakingRequestBody, postMarketMakingRequest } from './marketMaking.js';
|
|
2
|
+
/** `POST /api/v1/tentacles/market-making/` with `type: 'predicted_order_book'`. */
|
|
3
|
+
export async function fetchPredictedOrderBook(node, exchangeConfig, marketMakingConfig, options = {}) {
|
|
4
|
+
const body = marketMakingRequestBody('predicted_order_book', exchangeConfig, marketMakingConfig);
|
|
5
|
+
return postMarketMakingRequest(node, body, options);
|
|
6
|
+
}
|
|
7
|
+
//# sourceMappingURL=orderBookPreview.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"orderBookPreview.js","sourceRoot":"","sources":["../../src/node-api/orderBookPreview.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,uBAAuB,EAAE,uBAAuB,EAAmC,MAAM,mBAAmB,CAAA;AAIrH,mFAAmF;AACnF,MAAM,CAAC,KAAK,UAAU,uBAAuB,CAC3C,IAAkB,EAClB,cAAoC,EACpC,kBAA6C,EAC7C,UAA0D,EAAE;IAE5D,MAAM,IAAI,GAAG,uBAAuB,CAAC,sBAAsB,EAAE,cAAc,EAAE,kBAAkB,CAAC,CAAA;IAChG,OAAO,uBAAuB,CAA6B,IAAI,EAAE,IAAI,EAAE,OAAO,CAAC,CAAA;AACjF,CAAC"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/** What a node's pairing QR turned out to carry.
|
|
2
|
+
*
|
|
3
|
+
* `'wallet'` — `secret` is the wallet itself, which the node exports while
|
|
4
|
+
* building the QR, so importing needs no network at all. A BIP39 phrase when
|
|
5
|
+
* the node has one, else a 0x private key — see `nodeWalletFromSecret` in
|
|
6
|
+
* ./wallet.ts, which is what reads it, and why a phrase from here is derived
|
|
7
|
+
* differently to one an app generated itself.
|
|
8
|
+
*
|
|
9
|
+
* `'credential'` — a QR from a node that predates that change. `secret` is only
|
|
10
|
+
* the HTTP Basic password, and the wallet still has to be read off the node. */
|
|
11
|
+
export type NodePairingPayload = {
|
|
12
|
+
url: string;
|
|
13
|
+
address: string;
|
|
14
|
+
secret: string;
|
|
15
|
+
secretKind: 'wallet' | 'credential';
|
|
16
|
+
};
|
|
17
|
+
/** The node's "Pair mobile device" QR (node settings → wallet management, or the
|
|
18
|
+
* setup wizard) encodes JSON.stringify({ url, address, password }). Older nodes
|
|
19
|
+
* send `passphrase` instead and mean something different by it — the field name
|
|
20
|
+
* is what tells the two apart, so both are read here and normalised to one
|
|
21
|
+
* shape. Returns null when the payload is neither. */
|
|
22
|
+
export declare function parseNodePairingQr(data: string): NodePairingPayload | null;
|
|
23
|
+
/** Derive { host, port, secure } from a pairing QR's `url` field. */
|
|
24
|
+
export declare function parsePairingHost(url: string): {
|
|
25
|
+
host: string;
|
|
26
|
+
port: number;
|
|
27
|
+
secure: boolean;
|
|
28
|
+
} | null;
|
|
29
|
+
export type NodeCredentialCheck = {
|
|
30
|
+
status: 'authorized';
|
|
31
|
+
} | {
|
|
32
|
+
status: 'unauthorized';
|
|
33
|
+
} | {
|
|
34
|
+
status: 'error';
|
|
35
|
+
};
|
|
36
|
+
/** Verify address/password against the node's `GET /api/v1/login/test` — the only
|
|
37
|
+
* endpoint that exercises HTTP Basic auth without side effects. */
|
|
38
|
+
export declare function verifyNodeCredentials(baseUrl: string, address: string, password: string, signal?: AbortSignal): Promise<NodeCredentialCheck>;
|
|
39
|
+
//# sourceMappingURL=pairing.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pairing.d.ts","sourceRoot":"","sources":["../../src/node-api/pairing.ts"],"names":[],"mappings":"AAIA;;;;;;;;;iFASiF;AACjF,MAAM,MAAM,kBAAkB,GAAG;IAC/B,GAAG,EAAE,MAAM,CAAA;IACX,OAAO,EAAE,MAAM,CAAA;IACf,MAAM,EAAE,MAAM,CAAA;IACd,UAAU,EAAE,QAAQ,GAAG,YAAY,CAAA;CACpC,CAAA;AAED;;;;uDAIuD;AACvD,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,MAAM,GAAG,kBAAkB,GAAG,IAAI,CAgB1E;AAED,qEAAqE;AACrE,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,MAAM;;;;SAE3C;AAED,MAAM,MAAM,mBAAmB,GAC3B;IAAE,MAAM,EAAE,YAAY,CAAA;CAAE,GACxB;IAAE,MAAM,EAAE,cAAc,CAAA;CAAE,GAC1B;IAAE,MAAM,EAAE,OAAO,CAAA;CAAE,CAAA;AAEvB;oEACoE;AACpE,wBAAsB,qBAAqB,CACzC,OAAO,EAAE,MAAM,EACf,OAAO,EAAE,MAAM,EACf,QAAQ,EAAE,MAAM,EAChB,MAAM,CAAC,EAAE,WAAW,GACnB,OAAO,CAAC,mBAAmB,CAAC,CAoB9B"}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { parseHostInput } from '../transport/urls.js';
|
|
2
|
+
const VERIFY_TIMEOUT_MS = 8000;
|
|
3
|
+
/** The node's "Pair mobile device" QR (node settings → wallet management, or the
|
|
4
|
+
* setup wizard) encodes JSON.stringify({ url, address, password }). Older nodes
|
|
5
|
+
* send `passphrase` instead and mean something different by it — the field name
|
|
6
|
+
* is what tells the two apart, so both are read here and normalised to one
|
|
7
|
+
* shape. Returns null when the payload is neither. */
|
|
8
|
+
export function parseNodePairingQr(data) {
|
|
9
|
+
try {
|
|
10
|
+
const parsed = JSON.parse(data.trim());
|
|
11
|
+
if (!parsed || typeof parsed !== 'object')
|
|
12
|
+
return null;
|
|
13
|
+
const { url, address } = parsed;
|
|
14
|
+
if (typeof url !== 'string' || typeof address !== 'string')
|
|
15
|
+
return null;
|
|
16
|
+
if (typeof parsed.password === 'string') {
|
|
17
|
+
return { url, address, secret: parsed.password, secretKind: 'wallet' };
|
|
18
|
+
}
|
|
19
|
+
if (typeof parsed.passphrase === 'string') {
|
|
20
|
+
return { url, address, secret: parsed.passphrase, secretKind: 'credential' };
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
catch {
|
|
24
|
+
// not JSON — not a node pairing QR
|
|
25
|
+
}
|
|
26
|
+
return null;
|
|
27
|
+
}
|
|
28
|
+
/** Derive { host, port, secure } from a pairing QR's `url` field. */
|
|
29
|
+
export function parsePairingHost(url) {
|
|
30
|
+
return parseHostInput(url);
|
|
31
|
+
}
|
|
32
|
+
/** Verify address/password against the node's `GET /api/v1/login/test` — the only
|
|
33
|
+
* endpoint that exercises HTTP Basic auth without side effects. */
|
|
34
|
+
export async function verifyNodeCredentials(baseUrl, address, password, signal) {
|
|
35
|
+
const internalController = new AbortController();
|
|
36
|
+
const timer = setTimeout(() => internalController.abort(), VERIFY_TIMEOUT_MS);
|
|
37
|
+
const onCallerAbort = () => internalController.abort();
|
|
38
|
+
if (signal)
|
|
39
|
+
signal.addEventListener('abort', onCallerAbort);
|
|
40
|
+
try {
|
|
41
|
+
const res = await fetch(`${baseUrl}/api/v1/login/test`, {
|
|
42
|
+
method: 'GET',
|
|
43
|
+
headers: { Authorization: `Basic ${btoa(`${address}:${password}`)}` },
|
|
44
|
+
signal: internalController.signal,
|
|
45
|
+
});
|
|
46
|
+
if (res.status === 401 || res.status === 403)
|
|
47
|
+
return { status: 'unauthorized' };
|
|
48
|
+
if (!res.ok)
|
|
49
|
+
return { status: 'error' };
|
|
50
|
+
return { status: 'authorized' };
|
|
51
|
+
}
|
|
52
|
+
catch {
|
|
53
|
+
return { status: 'error' };
|
|
54
|
+
}
|
|
55
|
+
finally {
|
|
56
|
+
clearTimeout(timer);
|
|
57
|
+
if (signal)
|
|
58
|
+
signal.removeEventListener('abort', onCallerAbort);
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
//# sourceMappingURL=pairing.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pairing.js","sourceRoot":"","sources":["../../src/node-api/pairing.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAA;AAErD,MAAM,iBAAiB,GAAG,IAA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,MAAM,aAAa,GAAG,GAAG,EAAE,CAAC,kBAAkB,CAAC,KAAK,EAAE,CAAA;IACtD,IAAI,MAAM;QAAE,MAAM,CAAC,gBAAgB,CAAC,OAAO,EAAE,aAAa,CAAC,CAAA;IAC3D,IAAI,CAAC;QACH,MAAM,GAAG,GAAG,MAAM,KAAK,CAAC,GAAG,OAAO,oBAAoB,EAAE;YACtD,MAAM,EAAE,KAAK;YACb,OAAO,EAAE,EAAE,aAAa,EAAE,SAAS,IAAI,CAAC,GAAG,OAAO,IAAI,QAAQ,EAAE,CAAC,EAAE,EAAE;YACrE,MAAM,EAAE,kBAAkB,CAAC,MAAM;SAClC,CAAC,CAAA;QACF,IAAI,GAAG,CAAC,MAAM,KAAK,GAAG,IAAI,GAAG,CAAC,MAAM,KAAK,GAAG;YAAE,OAAO,EAAE,MAAM,EAAE,cAAc,EAAE,CAAA;QAC/E,IAAI,CAAC,GAAG,CAAC,EAAE;YAAE,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,CAAA;QACvC,OAAO,EAAE,MAAM,EAAE,YAAY,EAAE,CAAA;IACjC,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,CAAA;IAC5B,CAAC;YAAS,CAAC;QACT,YAAY,CAAC,KAAK,CAAC,CAAA;QACnB,IAAI,MAAM;YAAE,MAAM,CAAC,mBAAmB,CAAC,OAAO,EAAE,aAAa,CAAC,CAAA;IAChE,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import type { NodeEndpoint } from '../transport/urls.js';
|
|
2
|
+
import { type LegacyTradedPairsByExchange, type TradedPairsByExchange } from './exchanges.js';
|
|
3
|
+
/** A trading pair surfaced to an automation's pair-selection step. */
|
|
4
|
+
export type AutomationPair = {
|
|
5
|
+
symbol: string;
|
|
6
|
+
base: string;
|
|
7
|
+
quote: string;
|
|
8
|
+
type: string;
|
|
9
|
+
active: boolean;
|
|
10
|
+
/** 24h volumes as reported by the exchange for this exact pair, when the
|
|
11
|
+
* node answered a `with_volume` request. Undefined otherwise (older node,
|
|
12
|
+
* volume lookup unsupported, or the ticker had no entry). */
|
|
13
|
+
baseVolume?: number | null;
|
|
14
|
+
quoteVolume?: number | null;
|
|
15
|
+
};
|
|
16
|
+
/** Node's `traded-pairs` payload is untyped JSON — validate its actual shape
|
|
17
|
+
* here rather than trusting the declared type at the call site, so a
|
|
18
|
+
* mismatched/unexpected response throws a clear error instead of a bare "X
|
|
19
|
+
* is not a function" once a non-string symbol reaches `symbolToPair`.
|
|
20
|
+
*
|
|
21
|
+
* Two per-exchange shapes are accepted: the current symbol → volume map, and
|
|
22
|
+
* the bare symbol array older nodes still answer. Anything else is a payload
|
|
23
|
+
* we don't understand — throwing beats silently returning an empty list.
|
|
24
|
+
*
|
|
25
|
+
* A symbol listed by more than one exchange yields one pair (the list is
|
|
26
|
+
* keyed by symbol downstream), keeping the first volumes reported for it. */
|
|
27
|
+
export declare function extractPairs(byExchange: TradedPairsByExchange | LegacyTradedPairsByExchange): AutomationPair[];
|
|
28
|
+
/** Fetch and normalize the traded pairs for one exchange on one node. Falls
|
|
29
|
+
* back to the volume-less request when the node can't fetch tickers for
|
|
30
|
+
* this exchange (501) rather than surfacing no pairs at all. */
|
|
31
|
+
export declare function fetchPairsFromNode(node: NodeEndpoint, providerId: string, signal?: AbortSignal): Promise<AutomationPair[]>;
|
|
32
|
+
//# sourceMappingURL=pairs.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pairs.d.ts","sourceRoot":"","sources":["../../src/node-api/pairs.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAA;AAExD,OAAO,EAEL,KAAK,2BAA2B,EAChC,KAAK,qBAAqB,EAC3B,MAAM,gBAAgB,CAAA;AAEvB,sEAAsE;AACtE,MAAM,MAAM,cAAc,GAAG;IAC3B,MAAM,EAAE,MAAM,CAAA;IACd,IAAI,EAAE,MAAM,CAAA;IACZ,KAAK,EAAE,MAAM,CAAA;IACb,IAAI,EAAE,MAAM,CAAA;IACZ,MAAM,EAAE,OAAO,CAAA;IACf;;kEAE8D;IAC9D,UAAU,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IAC1B,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;CAC5B,CAAA;AAeD;;;;;;;;;;8EAU8E;AAC9E,wBAAgB,YAAY,CAC1B,UAAU,EAAE,qBAAqB,GAAG,2BAA2B,GAC9D,cAAc,EAAE,CA0BlB;AAED;;iEAEiE;AACjE,wBAAsB,kBAAkB,CACtC,IAAI,EAAE,YAAY,EAClB,UAAU,EAAE,MAAM,EAClB,MAAM,CAAC,EAAE,WAAW,GACnB,OAAO,CAAC,cAAc,EAAE,CAAC,CAU3B"}
|