@toon-protocol/client 0.21.1 → 0.21.3
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 +12 -2
- package/dist/index.js +17 -5
- package/dist/index.js.map +1 -1
- package/package.json +2 -1
package/dist/index.d.ts
CHANGED
|
@@ -1769,8 +1769,18 @@ declare class ToonClient {
|
|
|
1769
1769
|
* `start()` would register and that `rig fund` prints — so all configured
|
|
1770
1770
|
* chains appear even before a start. Best-effort per chain: an unreachable
|
|
1771
1771
|
* RPC yields `{ unreadable: true }` for that chain, never failing the others.
|
|
1772
|
-
|
|
1773
|
-
|
|
1772
|
+
*
|
|
1773
|
+
* `fallback` supplies Solana/Mina channel params (RPC/GraphQL + token) to use
|
|
1774
|
+
* ONLY when `config.solanaChannel`/`config.minaChannel` are unset — a
|
|
1775
|
+
* wallet-view-only default (e.g. the network preset's public RPC) that lets a
|
|
1776
|
+
* caller show all three chains, reading 0 for a not-yet-on-chain account,
|
|
1777
|
+
* WITHOUT injecting those channels into the client's settlement config (which
|
|
1778
|
+
* would change chain negotiation). Explicit config wins.
|
|
1779
|
+
*/
|
|
1780
|
+
getWalletBalances(fallback?: {
|
|
1781
|
+
solanaChannel?: ToonClientConfig['solanaChannel'];
|
|
1782
|
+
minaChannel?: ToonClientConfig['minaChannel'];
|
|
1783
|
+
}): Promise<WalletChainBalances[]>;
|
|
1774
1784
|
/**
|
|
1775
1785
|
* Resolves an ILP destination address to a peer ID.
|
|
1776
1786
|
* Convention: destination "g.toon.peer1" → peerId "peer1" (last segment).
|
package/dist/index.js
CHANGED
|
@@ -969,7 +969,12 @@ function parseBtpMessage(buf) {
|
|
|
969
969
|
const dataLen = readUint32BE(buf, offset);
|
|
970
970
|
offset += 4;
|
|
971
971
|
const data = buf.slice(offset, offset + dataLen);
|
|
972
|
-
|
|
972
|
+
const message = textDecoder.decode(data);
|
|
973
|
+
return {
|
|
974
|
+
type,
|
|
975
|
+
requestId,
|
|
976
|
+
data: { code, name, triggeredAt, message, data }
|
|
977
|
+
};
|
|
973
978
|
}
|
|
974
979
|
const pdCount = readUint8(buf, offset);
|
|
975
980
|
offset += 1;
|
|
@@ -1187,7 +1192,7 @@ var IsomorphicBtpClient = class {
|
|
|
1187
1192
|
const errData = message.data;
|
|
1188
1193
|
reject(
|
|
1189
1194
|
new BtpAuthError(
|
|
1190
|
-
`Authentication failed: ${errData.code} msg=${errData.message ?? ""} trigger=${errData.
|
|
1195
|
+
`Authentication failed: ${errData.code} msg=${errData.message ?? ""} trigger=${errData.triggeredAt ?? ""}`
|
|
1191
1196
|
)
|
|
1192
1197
|
);
|
|
1193
1198
|
} else if (message.type === BTPMessageType.RESPONSE) {
|
|
@@ -5820,8 +5825,15 @@ var ToonClient = class {
|
|
|
5820
5825
|
* `start()` would register and that `rig fund` prints — so all configured
|
|
5821
5826
|
* chains appear even before a start. Best-effort per chain: an unreachable
|
|
5822
5827
|
* RPC yields `{ unreadable: true }` for that chain, never failing the others.
|
|
5828
|
+
*
|
|
5829
|
+
* `fallback` supplies Solana/Mina channel params (RPC/GraphQL + token) to use
|
|
5830
|
+
* ONLY when `config.solanaChannel`/`config.minaChannel` are unset — a
|
|
5831
|
+
* wallet-view-only default (e.g. the network preset's public RPC) that lets a
|
|
5832
|
+
* caller show all three chains, reading 0 for a not-yet-on-chain account,
|
|
5833
|
+
* WITHOUT injecting those channels into the client's settlement config (which
|
|
5834
|
+
* would change chain negotiation). Explicit config wins.
|
|
5823
5835
|
*/
|
|
5824
|
-
async getWalletBalances() {
|
|
5836
|
+
async getWalletBalances(fallback) {
|
|
5825
5837
|
const sources = {};
|
|
5826
5838
|
let derived;
|
|
5827
5839
|
let derivedTried = false;
|
|
@@ -5853,7 +5865,7 @@ var ToonClient = class {
|
|
|
5853
5865
|
};
|
|
5854
5866
|
}
|
|
5855
5867
|
}
|
|
5856
|
-
const sol = this.config.solanaChannel;
|
|
5868
|
+
const sol = this.config.solanaChannel ?? fallback?.solanaChannel;
|
|
5857
5869
|
if (sol?.rpcUrl) {
|
|
5858
5870
|
const solAddress = this.getSolanaAddress() ?? (await ensureDerived())?.solana.publicKey;
|
|
5859
5871
|
if (solAddress) {
|
|
@@ -5865,7 +5877,7 @@ var ToonClient = class {
|
|
|
5865
5877
|
};
|
|
5866
5878
|
}
|
|
5867
5879
|
}
|
|
5868
|
-
const mina = this.config.minaChannel;
|
|
5880
|
+
const mina = this.config.minaChannel ?? fallback?.minaChannel;
|
|
5869
5881
|
if (mina?.graphqlUrl) {
|
|
5870
5882
|
const minaAddress = this.getMinaAddress() ?? (await ensureDerived())?.mina.publicKey;
|
|
5871
5883
|
if (minaAddress) {
|