@toon-protocol/core 1.6.0 → 2.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +21 -21
- package/dist/index.js +8 -1
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -479,7 +479,7 @@ interface IlpPeerInfo {
|
|
|
479
479
|
swapPairs?: SwapPair[];
|
|
480
480
|
}
|
|
481
481
|
/**
|
|
482
|
-
* Declarative advertisement of a token swap pair supported by a swap-capable peer (
|
|
482
|
+
* Declarative advertisement of a token swap pair supported by a swap-capable peer (Swap).
|
|
483
483
|
*
|
|
484
484
|
* Source and target assets use the same `{blockchain}:{network}[:{chainId}]` chain format
|
|
485
485
|
* as `IlpPeerInfo.supportedChains`. Rate is serialized as a decimal string (not a float) to
|
|
@@ -2473,15 +2473,15 @@ declare function resolveTokenForChain(chain: string, requesterPreferredTokens?:
|
|
|
2473
2473
|
* Shared balance-proof hash helpers — the single source of truth for the
|
|
2474
2474
|
* byte/field layout that ALL signers and verifiers across the monorepo depend
|
|
2475
2475
|
* on:
|
|
2476
|
-
* - the
|
|
2476
|
+
* - the Swap-side signer (`packages/swap/src/payment-channel-signer.ts`)
|
|
2477
2477
|
* - the sender-side settlement verifier (`packages/sdk/src/settlement/{evm,solana,mina}.ts`)
|
|
2478
2478
|
* - the client-side balance-proof signers (`packages/client/src/signing/{solana,mina}-signer.ts`)
|
|
2479
2479
|
*
|
|
2480
|
-
* Originally extracted from the
|
|
2480
|
+
* Originally extracted from the Swap signer (Story 12.4) into `@toon-protocol/sdk`
|
|
2481
2481
|
* (Story 12.6 AC-6). Relocated here to `@toon-protocol/core` so the client can
|
|
2482
2482
|
* consume the canonical hashes WITHOUT taking a dependency on `@toon-protocol/sdk`
|
|
2483
2483
|
* (the client only depends on core). `@toon-protocol/sdk` re-exports these names
|
|
2484
|
-
* unchanged, so
|
|
2484
|
+
* unchanged, so Swap and existing SDK consumers are unaffected.
|
|
2485
2485
|
*
|
|
2486
2486
|
* Any change to a hash layout here automatically applies to every signer AND
|
|
2487
2487
|
* verifier — they cannot drift.
|
|
@@ -2533,7 +2533,7 @@ declare function balanceProofHashSolana(channelId: string, cumulativeAmount: big
|
|
|
2533
2533
|
* `channelId` / `recipient` strings into the fixed field-element array a Mina
|
|
2534
2534
|
* Schnorr signature is computed over.
|
|
2535
2535
|
*
|
|
2536
|
-
* @stable —
|
|
2536
|
+
* @stable — Swap signer and SDK verifier depend on the exact derivation.
|
|
2537
2537
|
*/
|
|
2538
2538
|
declare function minaHashToField(s: string): bigint;
|
|
2539
2539
|
/**
|
|
@@ -2543,20 +2543,20 @@ declare function minaHashToField(s: string): bigint;
|
|
|
2543
2543
|
* nonce,
|
|
2544
2544
|
* minaHashToField(recipient) ]
|
|
2545
2545
|
*
|
|
2546
|
-
* This is the EXACT `fields` array that the
|
|
2546
|
+
* This is the EXACT `fields` array that the Swap's `MinaPaymentChannelSigner`
|
|
2547
2547
|
* passes to `mina-signer`'s `signFields(...)`, and that the sender-side
|
|
2548
2548
|
* `verifyMinaSignature` re-derives and passes to `verifyFields(...)`. Keeping
|
|
2549
|
-
* the derivation here (shared across `@toon-protocol/
|
|
2549
|
+
* the derivation here (shared across `@toon-protocol/swap`, `@toon-protocol/sdk`,
|
|
2550
2550
|
* and `@toon-protocol/client`) prevents signer/verifier drift — mirroring the
|
|
2551
2551
|
* EVM/Solana hash helpers above.
|
|
2552
2552
|
*
|
|
2553
|
-
* NOTE: this is the
|
|
2553
|
+
* NOTE: this is the Swap↔sender wire contract (a Schnorr signature over four
|
|
2554
2554
|
* field elements), NOT the connector's on-chain `MinaPaymentChannelSDK`
|
|
2555
2555
|
* Poseidon-commitment proof shape. The two are distinct; see
|
|
2556
2556
|
* `packages/sdk/src/settlement/mina.ts` for the relationship + the
|
|
2557
2557
|
* remaining on-chain-settlement gap.
|
|
2558
2558
|
*
|
|
2559
|
-
* @stable —
|
|
2559
|
+
* @stable — Swap signer and SDK verifier depend on the exact byte layout.
|
|
2560
2560
|
*/
|
|
2561
2561
|
declare function balanceProofFieldsMina(channelId: string, cumulativeAmount: bigint, nonce: bigint, recipient: string): bigint[];
|
|
2562
2562
|
|
|
@@ -2582,13 +2582,13 @@ declare function base58Decode(str: string): Uint8Array;
|
|
|
2582
2582
|
/**
|
|
2583
2583
|
* Mina private-key format conversion.
|
|
2584
2584
|
*
|
|
2585
|
-
* `deriveFullIdentity()` / `
|
|
2585
|
+
* `deriveFullIdentity()` / `deriveSwapKeys()` emit a Mina Pallas scalar as a
|
|
2586
2586
|
* big-endian hex string, but `mina-signer`'s `signFields`/`derivePublicKey`
|
|
2587
2587
|
* require the Mina base58check (`EK…`) private-key format. This helper bridges
|
|
2588
2588
|
* the two so a hex-derived Mina key produces signatures verifiable by the
|
|
2589
2589
|
* sender-side `verifyMinaSignature`.
|
|
2590
2590
|
*
|
|
2591
|
-
* Mirrors `hexToMinaBase58PrivateKey` in `packages/
|
|
2591
|
+
* Mirrors `hexToMinaBase58PrivateKey` in `packages/swap/src/payment-channel-signer.ts`
|
|
2592
2592
|
* (same fixed Mina base58check wire standard — version byte `0x5a`, non-zero
|
|
2593
2593
|
* tag `0x01`, little-endian scalar, double-sha256 checksum).
|
|
2594
2594
|
*
|
|
@@ -2608,11 +2608,11 @@ declare function hexToMinaBase58PrivateKey(privateKey: string): string;
|
|
|
2608
2608
|
* Derive the Mina base58 (`B62…`) public key for a private-key scalar, using
|
|
2609
2609
|
* the optional `mina-signer` peer dep.
|
|
2610
2610
|
*
|
|
2611
|
-
* `deriveFullIdentity()` / `
|
|
2611
|
+
* `deriveFullIdentity()` / `deriveSwapKeys()` emit only a keccak **hex
|
|
2612
2612
|
* placeholder** for the Mina public key — they deliberately avoid pulling
|
|
2613
2613
|
* Pallas curve math into derivation. That placeholder is unfundable and is
|
|
2614
2614
|
* rejected by Mina GraphQL balance queries, so wallet views that display it
|
|
2615
|
-
* (e.g.
|
|
2615
|
+
* (e.g. a swap node's `/wallet/balances` Mina leg) show an unusable hex
|
|
2616
2616
|
* string. This resolves the real, fundable `B62…` address when `mina-signer`
|
|
2617
2617
|
* is installed.
|
|
2618
2618
|
*
|
|
@@ -3677,7 +3677,7 @@ type ChainType = 'evm' | 'solana' | 'mina';
|
|
|
3677
3677
|
* `anvil` is the local-dev chain. `arbitrum-*` and `base-*` are the public
|
|
3678
3678
|
* Arbitrum and Base networks used by the network-mode resolver
|
|
3679
3679
|
* (see network-profile.ts). Base is the primary EVM chain for single-EVM
|
|
3680
|
-
* nodes; the apex connector and
|
|
3680
|
+
* nodes; the apex connector and Swap can hold providers for both families.
|
|
3681
3681
|
*/
|
|
3682
3682
|
type ChainName = 'anvil' | 'arbitrum-sepolia' | 'arbitrum-one' | 'base-sepolia' | 'base-mainnet';
|
|
3683
3683
|
/**
|
|
@@ -3910,7 +3910,7 @@ declare function buildSolanaProviderEntry(config: SolanaChainPreset, keyId: stri
|
|
|
3910
3910
|
declare function buildMinaProviderEntry(config: MinaChainPreset, keyId?: string): MinaProviderConfigEntry;
|
|
3911
3911
|
|
|
3912
3912
|
/**
|
|
3913
|
-
* Network-mode resolution for the
|
|
3913
|
+
* Network-mode resolution for the TOON connector `network` flag.
|
|
3914
3914
|
*
|
|
3915
3915
|
* A single operator-facing selector — `mainnet | testnet | devnet | custom` —
|
|
3916
3916
|
* resolves a coherent multi-chain configuration that is consumed by BOTH:
|
|
@@ -3918,18 +3918,18 @@ declare function buildMinaProviderEntry(config: MinaChainPreset, keyId?: string)
|
|
|
3918
3918
|
* to point at the project's dev chains — e.g. the Akash-hosted anvil + solana.)
|
|
3919
3919
|
*
|
|
3920
3920
|
* - the **apex** standalone connector (its `chainProviders` settlement array), and
|
|
3921
|
-
* - the **children** node containers (
|
|
3921
|
+
* - the **children** node containers (relay/swap), via a small set of env vars the
|
|
3922
3922
|
* HS compose template interpolates (`EVM_CHAIN`, `EVM_RPC_URL`, `EVM_CHAIN_ID`,
|
|
3923
3923
|
* `EVM_USDC_ADDRESS`, `SOLANA_RPC_URL`, `SOLANA_USDC_MINT`).
|
|
3924
3924
|
*
|
|
3925
3925
|
* Design notes:
|
|
3926
3926
|
* - **All tiers are public.** No tier resolves to a local chain (anvil/lightnet),
|
|
3927
3927
|
* so a node never points at an unreachable `localhost` RPC. This is what fixes
|
|
3928
|
-
* the "JsonRpcProvider failed to detect network" boot-loop that left
|
|
3928
|
+
* the "JsonRpcProvider failed to detect network" boot-loop that left relay nodes
|
|
3929
3929
|
* permanently disconnected (an empty RPC fell back to the `anvil` preset whose
|
|
3930
3930
|
* `localhost:8545` does not exist in the HS network).
|
|
3931
|
-
* - **EVM = Base (primary) + Arbitrum.** The single-EVM
|
|
3932
|
-
* apex connector and
|
|
3931
|
+
* - **EVM = Base (primary) + Arbitrum.** The single-EVM relay node uses Base; the
|
|
3932
|
+
* apex connector and Swap can hold providers for both families.
|
|
3933
3933
|
* - **Settlement status.** TOON's settlement contracts are deployed for the
|
|
3934
3934
|
* public **testnet/devnet** tiers (EVM Base Sepolia registry + TokenNetwork,
|
|
3935
3935
|
* Solana devnet program, Mina devnet zkApp — source of truth: e2e/testnets.json),
|
|
@@ -3981,7 +3981,7 @@ interface NetworkFamilyStatus {
|
|
|
3981
3981
|
* Only keys with real values are present (absent ⇒ compose `${VAR:-}` default).
|
|
3982
3982
|
*/
|
|
3983
3983
|
interface NetworkNodeEnv {
|
|
3984
|
-
/** Primary EVM chain preset name →
|
|
3984
|
+
/** Primary EVM chain preset name → relay `TOON_CHAIN` (`'none'` ⇒ relay-only). */
|
|
3985
3985
|
EVM_CHAIN?: string;
|
|
3986
3986
|
EVM_RPC_URL?: string;
|
|
3987
3987
|
EVM_CHAIN_ID?: string;
|
|
@@ -4007,7 +4007,7 @@ interface NetworkProfile {
|
|
|
4007
4007
|
/** Per-family settlement readiness. */
|
|
4008
4008
|
status: NetworkFamilyStatus;
|
|
4009
4009
|
}
|
|
4010
|
-
/** Sentinel for the
|
|
4010
|
+
/** Sentinel for the relay node meaning "no EVM settlement chain — run relay-only". */
|
|
4011
4011
|
declare const RELAY_ONLY_CHAIN = "none";
|
|
4012
4012
|
/**
|
|
4013
4013
|
* Resolve a {@link NetworkProfile} from a network mode.
|
package/dist/index.js
CHANGED
|
@@ -2232,7 +2232,14 @@ var NostrPeerDiscovery = class {
|
|
|
2232
2232
|
};
|
|
2233
2233
|
|
|
2234
2234
|
// src/discovery/genesis-peers.json
|
|
2235
|
-
var genesis_peers_default = [
|
|
2235
|
+
var genesis_peers_default = [
|
|
2236
|
+
{
|
|
2237
|
+
pubkey: "2813187eb66741f9509de2055161f328a0f04e01e1fc20188610b8dbd0591ea5",
|
|
2238
|
+
relayUrl: "wss://relay-ws.devnet.toonprotocol.dev",
|
|
2239
|
+
ilpAddress: "g.proxy",
|
|
2240
|
+
btpEndpoint: "wss://proxy.devnet.toonprotocol.dev:443"
|
|
2241
|
+
}
|
|
2242
|
+
];
|
|
2236
2243
|
|
|
2237
2244
|
// src/discovery/GenesisPeerLoader.ts
|
|
2238
2245
|
var PUBKEY_REGEX3 = /^[0-9a-f]{64}$/;
|