@liquidium/client 0.7.1 → 0.8.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 +2 -0
- package/dist/index.cjs +7 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +4 -2
- package/dist/index.d.ts +4 -2
- package/dist/index.js +7 -0
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Agent, Identity } from '@icp-sdk/core/agent';
|
|
2
2
|
import { PublicClient } from 'viem';
|
|
3
3
|
|
|
4
4
|
/**
|
|
@@ -22,6 +22,8 @@ interface EvmReadClient {
|
|
|
22
22
|
interface LiquidiumClientConfig {
|
|
23
23
|
/** Preset canister IDs. Only `mainnet` is bundled. */
|
|
24
24
|
environment?: Environment;
|
|
25
|
+
/** Preconfigured ICP agent. Takes precedence over `icHost` and `identity`. */
|
|
26
|
+
agent?: Agent;
|
|
25
27
|
/** ICP replica host override (defaults follow `@icp-sdk/core/agent`). */
|
|
26
28
|
icHost?: string;
|
|
27
29
|
/** Agent identity for signed canister calls. */
|
|
@@ -178,7 +180,7 @@ interface Wallet {
|
|
|
178
180
|
}
|
|
179
181
|
|
|
180
182
|
interface CanisterContext {
|
|
181
|
-
agent:
|
|
183
|
+
agent: Agent;
|
|
182
184
|
canisterIds: CanisterIds;
|
|
183
185
|
}
|
|
184
186
|
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Agent, Identity } from '@icp-sdk/core/agent';
|
|
2
2
|
import { PublicClient } from 'viem';
|
|
3
3
|
|
|
4
4
|
/**
|
|
@@ -22,6 +22,8 @@ interface EvmReadClient {
|
|
|
22
22
|
interface LiquidiumClientConfig {
|
|
23
23
|
/** Preset canister IDs. Only `mainnet` is bundled. */
|
|
24
24
|
environment?: Environment;
|
|
25
|
+
/** Preconfigured ICP agent. Takes precedence over `icHost` and `identity`. */
|
|
26
|
+
agent?: Agent;
|
|
25
27
|
/** ICP replica host override (defaults follow `@icp-sdk/core/agent`). */
|
|
26
28
|
icHost?: string;
|
|
27
29
|
/** Agent identity for signed canister calls. */
|
|
@@ -178,7 +180,7 @@ interface Wallet {
|
|
|
178
180
|
}
|
|
179
181
|
|
|
180
182
|
interface CanisterContext {
|
|
181
|
-
agent:
|
|
183
|
+
agent: Agent;
|
|
182
184
|
canisterIds: CanisterIds;
|
|
183
185
|
}
|
|
184
186
|
|
package/dist/index.js
CHANGED
|
@@ -319,6 +319,12 @@ function appendErrorContext(message, context) {
|
|
|
319
319
|
return `${message} (${details.join(", ")})`;
|
|
320
320
|
}
|
|
321
321
|
function createCanisterContext(opts) {
|
|
322
|
+
if (opts.agent) {
|
|
323
|
+
return {
|
|
324
|
+
agent: opts.agent,
|
|
325
|
+
canisterIds: opts.canisterIds
|
|
326
|
+
};
|
|
327
|
+
}
|
|
322
328
|
const host = resolveHost(opts.icHost);
|
|
323
329
|
const agent = HttpAgent.createSync({
|
|
324
330
|
host,
|
|
@@ -7723,6 +7729,7 @@ var LiquidiumClient = class {
|
|
|
7723
7729
|
const canisterIds = resolveCanisterIds(environment, config.canisterIds);
|
|
7724
7730
|
const timeoutMs = config.timeoutMs ?? DEFAULT_TIMEOUT_MS;
|
|
7725
7731
|
this.canisterContext = createCanisterContext({
|
|
7732
|
+
agent: config.agent,
|
|
7726
7733
|
icHost: config.icHost,
|
|
7727
7734
|
identity: config.identity,
|
|
7728
7735
|
canisterIds
|