@1stdex/first-sdk 1.0.13 → 1.0.15
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/cjs/calls/batch/prepare-market-order-with-setup.js +5 -1
- package/dist/cjs/calls/batch/prepare-market-order-with-setup.js.map +1 -1
- package/dist/cjs/calls/market/market.js.map +1 -1
- package/dist/cjs/constants/abis/core/claimable-dex-vault.js +1120 -0
- package/dist/cjs/constants/abis/core/claimable-dex-vault.js.map +1 -0
- package/dist/cjs/constants/abis/core/mirror-token-abi.js +58 -0
- package/dist/cjs/constants/abis/core/mirror-token-abi.js.map +1 -0
- package/dist/cjs/views/balance.js +85 -2
- package/dist/cjs/views/balance.js.map +1 -1
- package/dist/cjs/views/currency.js +3 -3
- package/dist/cjs/views/currency.js.map +1 -1
- package/dist/cjs/views/index.js +3 -2
- package/dist/cjs/views/index.js.map +1 -1
- package/dist/esm/calls/batch/prepare-market-order-with-setup.js +5 -1
- package/dist/esm/calls/batch/prepare-market-order-with-setup.js.map +1 -1
- package/dist/esm/calls/market/market.js.map +1 -1
- package/dist/esm/constants/abis/core/claimable-dex-vault.js +1117 -0
- package/dist/esm/constants/abis/core/claimable-dex-vault.js.map +1 -0
- package/dist/esm/constants/abis/core/mirror-token-abi.js +55 -0
- package/dist/esm/constants/abis/core/mirror-token-abi.js.map +1 -0
- package/dist/esm/views/balance.js +119 -1
- package/dist/esm/views/balance.js.map +1 -1
- package/dist/esm/views/currency.js +1 -1
- package/dist/esm/views/currency.js.map +1 -1
- package/dist/esm/views/index.js +2 -2
- package/dist/esm/views/index.js.map +1 -1
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/dist/types/calls/batch/prepare-market-order-with-setup.d.ts.map +1 -1
- package/dist/types/calls/market/market.d.ts.map +1 -1
- package/dist/types/constants/abis/core/claimable-dex-vault.d.ts +1565 -0
- package/dist/types/constants/abis/core/claimable-dex-vault.d.ts.map +1 -0
- package/dist/types/constants/abis/core/mirror-token-abi.d.ts +80 -0
- package/dist/types/constants/abis/core/mirror-token-abi.d.ts.map +1 -0
- package/dist/types/views/balance.d.ts +30 -0
- package/dist/types/views/balance.d.ts.map +1 -1
- package/dist/types/views/currency.d.ts +1 -1
- package/dist/types/views/currency.d.ts.map +1 -1
- package/dist/types/views/index.d.ts +2 -2
- package/dist/types/views/index.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"claimable-dex-vault.d.ts","sourceRoot":"","sources":["../../../../../src/constants/abis/core/claimable-dex-vault.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,uBAAuB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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
+
readonly internalType: "address";
|
|
6
|
+
readonly name: "";
|
|
7
|
+
readonly type: "address";
|
|
8
|
+
}];
|
|
9
|
+
readonly stateMutability: "view";
|
|
10
|
+
readonly type: "function";
|
|
11
|
+
}, {
|
|
12
|
+
readonly inputs: readonly [{
|
|
13
|
+
readonly internalType: "address[]";
|
|
14
|
+
readonly name: "recipients";
|
|
15
|
+
readonly type: "address[]";
|
|
16
|
+
}, {
|
|
17
|
+
readonly internalType: "uint256[]";
|
|
18
|
+
readonly name: "amounts";
|
|
19
|
+
readonly type: "uint256[]";
|
|
20
|
+
}];
|
|
21
|
+
readonly name: "addAllocations";
|
|
22
|
+
readonly outputs: readonly [];
|
|
23
|
+
readonly stateMutability: "nonpayable";
|
|
24
|
+
readonly type: "function";
|
|
25
|
+
}, {
|
|
26
|
+
readonly inputs: readonly [];
|
|
27
|
+
readonly name: "name";
|
|
28
|
+
readonly outputs: readonly [{
|
|
29
|
+
readonly internalType: "string";
|
|
30
|
+
readonly name: "";
|
|
31
|
+
readonly type: "string";
|
|
32
|
+
}];
|
|
33
|
+
readonly stateMutability: "view";
|
|
34
|
+
readonly type: "function";
|
|
35
|
+
}, {
|
|
36
|
+
readonly inputs: readonly [];
|
|
37
|
+
readonly name: "symbol";
|
|
38
|
+
readonly outputs: readonly [{
|
|
39
|
+
readonly internalType: "string";
|
|
40
|
+
readonly name: "";
|
|
41
|
+
readonly type: "string";
|
|
42
|
+
}];
|
|
43
|
+
readonly stateMutability: "view";
|
|
44
|
+
readonly type: "function";
|
|
45
|
+
}, {
|
|
46
|
+
readonly inputs: readonly [];
|
|
47
|
+
readonly name: "decimals";
|
|
48
|
+
readonly outputs: readonly [{
|
|
49
|
+
readonly internalType: "uint8";
|
|
50
|
+
readonly name: "";
|
|
51
|
+
readonly type: "uint8";
|
|
52
|
+
}];
|
|
53
|
+
readonly stateMutability: "view";
|
|
54
|
+
readonly type: "function";
|
|
55
|
+
}, {
|
|
56
|
+
readonly inputs: readonly [];
|
|
57
|
+
readonly name: "totalSupply";
|
|
58
|
+
readonly outputs: readonly [{
|
|
59
|
+
readonly internalType: "uint256";
|
|
60
|
+
readonly name: "";
|
|
61
|
+
readonly type: "uint256";
|
|
62
|
+
}];
|
|
63
|
+
readonly stateMutability: "view";
|
|
64
|
+
readonly type: "function";
|
|
65
|
+
}, {
|
|
66
|
+
readonly inputs: readonly [{
|
|
67
|
+
readonly internalType: "address";
|
|
68
|
+
readonly name: "account";
|
|
69
|
+
readonly type: "address";
|
|
70
|
+
}];
|
|
71
|
+
readonly name: "balanceOf";
|
|
72
|
+
readonly outputs: readonly [{
|
|
73
|
+
readonly internalType: "uint256";
|
|
74
|
+
readonly name: "";
|
|
75
|
+
readonly type: "uint256";
|
|
76
|
+
}];
|
|
77
|
+
readonly stateMutability: "view";
|
|
78
|
+
readonly type: "function";
|
|
79
|
+
}];
|
|
80
|
+
//# sourceMappingURL=mirror-token-abi.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mirror-token-abi.d.ts","sourceRoot":"","sources":["../../../../../src/constants/abis/core/mirror-token-abi.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAqDnB,CAAC"}
|
|
@@ -32,4 +32,34 @@ export declare const getTradingBalance: ({ chainId, userAddress, tokenAddress, o
|
|
|
32
32
|
vaultLocked: CurrencyAmount;
|
|
33
33
|
totalAvailable: CurrencyAmount;
|
|
34
34
|
}>;
|
|
35
|
+
/**
|
|
36
|
+
* Get the portfolio balance for a user and token.
|
|
37
|
+
* This includes total balance (wallet + vault) and real token balance for mirror tokens.
|
|
38
|
+
*
|
|
39
|
+
* @param chainId The chain ID of the blockchain.
|
|
40
|
+
* @param userAddress The address of the user.
|
|
41
|
+
* @param tokenAddress The address of the token.
|
|
42
|
+
* @param options Optional RPC URL.
|
|
43
|
+
* @returns A Promise resolving to portfolio balance information.
|
|
44
|
+
* @example
|
|
45
|
+
* import { getPortfolioBalance } from '@clober/v2-sdk'
|
|
46
|
+
*
|
|
47
|
+
* const portfolio = await getPortfolioBalance({
|
|
48
|
+
* chainId: 421614,
|
|
49
|
+
* userAddress: '0xF8c1869Ecd4df136693C45EcE1b67f85B6bDaE69',
|
|
50
|
+
* tokenAddress: '0x00bfd44e79fb7f6dd5887a9426c8ef85a0cd23e0'
|
|
51
|
+
* })
|
|
52
|
+
* console.log(`Total balance: ${portfolio.totalBalance.value} ${portfolio.totalBalance.currency.symbol}`)
|
|
53
|
+
*/
|
|
54
|
+
export declare const getPortfolioBalance: ({ chainId, userAddress, tokenAddress, options, }: {
|
|
55
|
+
chainId: CHAIN_IDS;
|
|
56
|
+
userAddress: `0x${string}`;
|
|
57
|
+
tokenAddress: `0x${string}`;
|
|
58
|
+
options?: {
|
|
59
|
+
rpcUrl?: string;
|
|
60
|
+
};
|
|
61
|
+
}) => Promise<{
|
|
62
|
+
totalBalance: CurrencyAmount;
|
|
63
|
+
totalRealTokenBalance: CurrencyAmount | undefined;
|
|
64
|
+
}>;
|
|
35
65
|
//# sourceMappingURL=balance.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"balance.d.ts","sourceRoot":"","sources":["../../../src/views/balance.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,SAAS,EAAa,MAAM,kCAAkC,CAAC;
|
|
1
|
+
{"version":3,"file":"balance.d.ts","sourceRoot":"","sources":["../../../src/views/balance.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,SAAS,EAAa,MAAM,kCAAkC,CAAC;AAIxE,OAAO,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAK1C;;;;;;;;;;;;;;;;;;GAkBG;AACH,eAAO,MAAM,iBAAiB,qDAK3B;IACD,OAAO,EAAE,SAAS,CAAC;IACnB,WAAW,EAAE,KAAK,MAAM,EAAE,CAAC;IAC3B,YAAY,EAAE,KAAK,MAAM,EAAE,CAAC;IAC5B,OAAO,CAAC,EAAE;QAAE,MAAM,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;CAC/B,KAAG,QAAQ;IACV,aAAa,EAAE,cAAc,CAAC;IAC9B,cAAc,EAAE,cAAc,CAAC;IAC/B,WAAW,EAAE,cAAc,CAAC;IAC5B,cAAc,EAAE,cAAc,CAAC;CAChC,CAuDA,CAAC;AAEF;;;;;;;;;;;;;;;;;;GAkBG;AACH,eAAO,MAAM,mBAAmB,qDAK7B;IACD,OAAO,EAAE,SAAS,CAAC;IACnB,WAAW,EAAE,KAAK,MAAM,EAAE,CAAC;IAC3B,YAAY,EAAE,KAAK,MAAM,EAAE,CAAC;IAC5B,OAAO,CAAC,EAAE;QAAE,MAAM,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;CAC/B,KAAG,QAAQ;IACV,YAAY,EAAE,cAAc,CAAC;IAC7B,qBAAqB,EAAE,cAAc,GAAG,SAAS,CAAC;CACnD,CA2HA,CAAC"}
|
|
@@ -17,7 +17,7 @@ export declare const getDailyClosePriceMap: ({ chainId, timestampInSeconds, }: {
|
|
|
17
17
|
}) => Promise<{
|
|
18
18
|
[address: `0x${string}`]: number;
|
|
19
19
|
}>;
|
|
20
|
-
export declare const
|
|
20
|
+
export declare const getLatestPrice: ({ chainId, tokenAddress, }: {
|
|
21
21
|
chainId: CHAIN_IDS;
|
|
22
22
|
tokenAddress: `0x${string}`;
|
|
23
23
|
}) => Promise<number>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"currency.d.ts","sourceRoot":"","sources":["../../../src/views/currency.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,kCAAkC,CAAC;AAE7D,OAAO,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAC;AAQtD,eAAO,MAAM,aAAa,iBAEvB;IACD,OAAO,EAAE,SAAS,CAAC;CACpB,KAAG,QAAQ,QAAQ,EAAE,CAEr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AAO,MAAM,cAAc,+BAGxB;IACD,OAAO,EAAE,SAAS,CAAC;IACnB,YAAY,EAAE,KAAK,MAAM,EAAE,CAAC;CAC7B,KAAG,QAAQ,MAAM,CAEjB,CAAC"}
|
|
@@ -3,9 +3,9 @@ export { getPriceNeighborhood } from './tick';
|
|
|
3
3
|
export { getOpenOrder, getOpenOrders } from './open-order';
|
|
4
4
|
export { getSubgraphEndpoint, getSubgraphBlockNumber, getSubgraphBlock, } from './subgraph';
|
|
5
5
|
export { getContractAddresses } from './address';
|
|
6
|
-
export { getCurrencies, getStableCurrencies, getLatestPriceMap, getDailyClosePriceMap,
|
|
6
|
+
export { getCurrencies, getStableCurrencies, getLatestPriceMap, getDailyClosePriceMap, getLatestPrice, } from './currency';
|
|
7
7
|
export { getProtocolAnalytics, getUserDailyVolumes, getTopUsersByNativeVolume, getUserNativeVolume, getReferralSummary, } from './analytics';
|
|
8
8
|
export { getVault } from './vault';
|
|
9
|
-
export { getTradingBalance } from './balance';
|
|
9
|
+
export { getTradingBalance, getPortfolioBalance } from './balance';
|
|
10
10
|
export { isOrderOperatorApproved, checkTokenAllowances, needsVaultDeposit, getOrderSetupStatus, } from './setup';
|
|
11
11
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/views/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,SAAS,EACT,YAAY,EACZ,iBAAiB,EACjB,iBAAiB,EACjB,gBAAgB,EAChB,kBAAkB,EAClB,iBAAiB,EACjB,aAAa,EACb,4BAA4B,GAC7B,MAAM,UAAU,CAAC;AAElB,OAAO,EAAE,oBAAoB,EAAE,MAAM,QAAQ,CAAC;AAC9C,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAC3D,OAAO,EACL,mBAAmB,EACnB,sBAAsB,EACtB,gBAAgB,GACjB,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,oBAAoB,EAAE,MAAM,WAAW,CAAC;AACjD,OAAO,EACL,aAAa,EACb,mBAAmB,EACnB,iBAAiB,EACjB,qBAAqB,EACrB,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/views/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,SAAS,EACT,YAAY,EACZ,iBAAiB,EACjB,iBAAiB,EACjB,gBAAgB,EAChB,kBAAkB,EAClB,iBAAiB,EACjB,aAAa,EACb,4BAA4B,GAC7B,MAAM,UAAU,CAAC;AAElB,OAAO,EAAE,oBAAoB,EAAE,MAAM,QAAQ,CAAC;AAC9C,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAC3D,OAAO,EACL,mBAAmB,EACnB,sBAAsB,EACtB,gBAAgB,GACjB,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,oBAAoB,EAAE,MAAM,WAAW,CAAC;AACjD,OAAO,EACL,aAAa,EACb,mBAAmB,EACnB,iBAAiB,EACjB,qBAAqB,EACrB,cAAc,GACf,MAAM,YAAY,CAAC;AACpB,OAAO,EACL,oBAAoB,EACpB,mBAAmB,EACnB,yBAAyB,EACzB,mBAAmB,EACnB,kBAAkB,GACnB,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AACnC,OAAO,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,MAAM,WAAW,CAAC;AACnE,OAAO,EACL,uBAAuB,EACvB,oBAAoB,EACpB,iBAAiB,EACjB,mBAAmB,GACpB,MAAM,SAAS,CAAC"}
|