@ldgr/client 0.2.0 → 0.2.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 +7 -3
- package/dist/index.js +4 -1
- package/dist/types.d.ts +11 -1
- package/package.json +13 -16
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type LdgrClientOptions, type LdgrTransaction, type PaymentExpectation, type PaymentVerification, type SignedSubmission } from "./types";
|
|
1
|
+
import { type LdgrClientOptions, type LdgrAsset, type LdgrTransaction, type PaymentExpectation, type PaymentVerification, type SignedSubmission } from "./types";
|
|
2
2
|
export declare function createLdgrClient(options: LdgrClientOptions): {
|
|
3
3
|
ledger: {
|
|
4
4
|
get: () => Promise<{
|
|
@@ -25,12 +25,16 @@ export declare function createLdgrClient(options: LdgrClientOptions): {
|
|
|
25
25
|
readonly nextNonce: string;
|
|
26
26
|
}>;
|
|
27
27
|
};
|
|
28
|
+
assets: {
|
|
29
|
+
get: (asset: string) => Promise<LdgrAsset>;
|
|
30
|
+
};
|
|
28
31
|
transactions: {
|
|
29
32
|
get: (transactionHash: string) => Promise<LdgrTransaction>;
|
|
30
33
|
};
|
|
31
34
|
amm: {
|
|
32
|
-
listPools: () => Promise<{
|
|
35
|
+
listPools: (cursor?: string, limit?: number) => Promise<{
|
|
33
36
|
readonly pools: readonly Record<string, unknown>[];
|
|
37
|
+
readonly nextCursor?: string;
|
|
34
38
|
}>;
|
|
35
39
|
getPool: (poolId: string) => Promise<Record<string, unknown>>;
|
|
36
40
|
getPoolByPair: (assetA: string, assetB: string) => Promise<Record<string, unknown>>;
|
|
@@ -69,6 +73,6 @@ export declare function createLdgrClient(options: LdgrClientOptions): {
|
|
|
69
73
|
}>(path: string, signed: SignedSubmission) => Promise<T>;
|
|
70
74
|
};
|
|
71
75
|
export { LdgrClientError } from "./types";
|
|
72
|
-
export type { LdgrClientOptions, LdgrNetwork, LdgrTransaction, PaymentExpectation, PaymentVerification, SignedSubmission } from "./types";
|
|
76
|
+
export type { LdgrAsset, LdgrClientOptions, LdgrNetwork, LdgrTransaction, PaymentExpectation, PaymentVerification, SignedSubmission } from "./types";
|
|
73
77
|
export { createWebCryptoSigner, generateLocalWallet, loadLocalWallet } from "./signer";
|
|
74
78
|
export type { LdgrSigner, LocalLdgrWallet } from "./signer";
|
package/dist/index.js
CHANGED
|
@@ -175,11 +175,14 @@ function createLdgrClient(options) {
|
|
|
175
175
|
getBalance: (address, asset) => transport.get(`/api/v1/balances/${encodePathSegment(address)}/${encodePathSegment(resolveAsset(asset))}`),
|
|
176
176
|
getNextNonce: (address, asset) => transport.get(`/api/v1/nonces/${encodePathSegment(address)}/${encodePathSegment(resolveAsset(asset))}`)
|
|
177
177
|
},
|
|
178
|
+
assets: {
|
|
179
|
+
get: (asset) => transport.get(`/api/v1/assets/${encodePathSegment(resolveAsset(asset))}`)
|
|
180
|
+
},
|
|
178
181
|
transactions: {
|
|
179
182
|
get: (transactionHash) => transport.get(`/api/v1/transactions/${normalizedHash(transactionHash)}`)
|
|
180
183
|
},
|
|
181
184
|
amm: {
|
|
182
|
-
listPools: () => transport.get("/api/v1/amm/pools"),
|
|
185
|
+
listPools: (cursor, limit) => transport.get(queryPath("/api/v1/amm/pools", { cursor, limit })),
|
|
183
186
|
getPool: (poolId) => transport.get(`/api/v1/amm/pools/${encodePathSegment(poolId)}`),
|
|
184
187
|
getPoolByPair: (assetA, assetB) => transport.get(`/api/v1/amm/pools/by-pair/${encodePathSegment(resolveAsset(assetA))}/${encodePathSegment(resolveAsset(assetB))}`),
|
|
185
188
|
quoteSwap: (poolId, assetIn, amountIn) => transport.get(queryPath(`/api/v1/amm/pools/${encodePathSegment(poolId)}/quote`, { assetIn: resolveAsset(assetIn), amountIn })),
|
package/dist/types.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { LdgrNetwork } from "@ldgr/protocol";
|
|
1
|
+
import type { AssetBridgePolicy, LdgrNetwork } from "@ldgr/protocol";
|
|
2
2
|
export type LedgerId = 0 | 1;
|
|
3
3
|
export type { LdgrNetwork } from "@ldgr/protocol";
|
|
4
4
|
export type LdgrTransaction = {
|
|
@@ -12,6 +12,16 @@ export type LdgrTransaction = {
|
|
|
12
12
|
readonly transactionHash: string;
|
|
13
13
|
readonly [key: string]: unknown;
|
|
14
14
|
};
|
|
15
|
+
/** Public asset metadata used to format user-facing balances and transfer amounts. */
|
|
16
|
+
export type LdgrAsset = {
|
|
17
|
+
readonly code: string;
|
|
18
|
+
readonly displayName: string;
|
|
19
|
+
readonly ticker?: string;
|
|
20
|
+
readonly decimals: number;
|
|
21
|
+
readonly active: boolean;
|
|
22
|
+
readonly bridgePolicy: AssetBridgePolicy;
|
|
23
|
+
readonly [key: string]: unknown;
|
|
24
|
+
};
|
|
15
25
|
export type PaymentExpectation = {
|
|
16
26
|
readonly to: string;
|
|
17
27
|
readonly asset?: string;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ldgr/client",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"types": "./dist/index.d.ts",
|
|
6
6
|
"exports": {
|
|
@@ -10,19 +10,16 @@
|
|
|
10
10
|
}
|
|
11
11
|
},
|
|
12
12
|
"files": ["dist", "README.md"],
|
|
13
|
-
"publishConfig": {
|
|
14
|
-
"
|
|
15
|
-
},
|
|
16
|
-
"
|
|
17
|
-
"
|
|
18
|
-
|
|
19
|
-
"
|
|
20
|
-
"
|
|
21
|
-
},
|
|
22
|
-
"
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
"test": "bun test",
|
|
26
|
-
"typecheck": "tsc -p tsconfig.json"
|
|
27
|
-
}
|
|
13
|
+
"publishConfig": { "access": "public" },
|
|
14
|
+
"engines": { "node": ">=20.19.0" },
|
|
15
|
+
"dependencies": { "@ldgr/protocol": "^0.2.0" },
|
|
16
|
+
"scripts": {
|
|
17
|
+
"build": "rm -rf dist && bun build src/index.ts --outdir dist --target node --format esm --packages external && tsc -p tsconfig.build.json",
|
|
18
|
+
"prepack": "bun run build",
|
|
19
|
+
"test": "bun test",
|
|
20
|
+
"typecheck": "tsc -p tsconfig.json"
|
|
21
|
+
},
|
|
22
|
+
"devDependencies": {
|
|
23
|
+
"typescript": "^5.9.3"
|
|
24
|
+
}
|
|
28
25
|
}
|