@spritz-finance/service-client 0.3.97 → 0.3.98
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/lib/web3/types.d.ts
CHANGED
|
@@ -28,6 +28,23 @@ export type TokenBalance = {
|
|
|
28
28
|
balanceUSD: number;
|
|
29
29
|
tokenImageUrl: string;
|
|
30
30
|
};
|
|
31
|
+
export type ChainBalance = {
|
|
32
|
+
chain: string;
|
|
33
|
+
tokenAddress: string;
|
|
34
|
+
balanceUsd: number;
|
|
35
|
+
balanceChangeUsd1d: number;
|
|
36
|
+
tokenAmount: number;
|
|
37
|
+
tokenAmountRaw: string;
|
|
38
|
+
tokenDecimals: number;
|
|
39
|
+
tokenSymbol: string;
|
|
40
|
+
tokenName: string;
|
|
41
|
+
tokenPriceUsd: number;
|
|
42
|
+
iconUrl: string;
|
|
43
|
+
};
|
|
44
|
+
export type Portfolio = {
|
|
45
|
+
tokens: ChainBalance[];
|
|
46
|
+
totalBalanceUsd: number;
|
|
47
|
+
};
|
|
31
48
|
export declare enum SignerUsageType {
|
|
32
49
|
BRIDGE_TRANSFER = 0,
|
|
33
50
|
RAIN_TRANSFER = 1
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
export * as Web3Client from './web3ServiceClient';
|
|
2
|
-
import { ExactInQuoteInput, ExactInQuoteResponse, OpsSignerType, SignerUsageType, TokenBalance, UserOpsSigner, WalletTokenBalanceInput } from './types';
|
|
2
|
+
import { ExactInQuoteInput, ExactInQuoteResponse, OpsSignerType, Portfolio, SignerUsageType, TokenBalance, UserOpsSigner, WalletTokenBalanceInput } from './types';
|
|
3
3
|
export declare function getExactInQuote(input: ExactInQuoteInput): Promise<ExactInQuoteResponse>;
|
|
4
4
|
export declare function getTokenBalances(input: WalletTokenBalanceInput): Promise<import("../types").ApiFailure | import("../types").ApiSuccess<TokenBalance[]>>;
|
|
5
|
+
export declare function getPortfolio(address: string): Promise<import("../types").ApiFailure | import("../types").ApiSuccess<Portfolio>>;
|
|
5
6
|
export declare function getUserOpsSigner(input: {
|
|
6
7
|
userId: string;
|
|
7
8
|
signerType: OpsSignerType;
|
|
@@ -23,7 +23,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
23
23
|
return result;
|
|
24
24
|
};
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
-
exports.createUserOpsSigner = exports.getSmartAccountAddress = exports.getUserOpsSignerByAddress = exports.getUserOpsSigner = exports.getTokenBalances = exports.getExactInQuote = exports.Web3Client = void 0;
|
|
26
|
+
exports.createUserOpsSigner = exports.getSmartAccountAddress = exports.getUserOpsSignerByAddress = exports.getUserOpsSigner = exports.getPortfolio = exports.getTokenBalances = exports.getExactInQuote = exports.Web3Client = void 0;
|
|
27
27
|
exports.Web3Client = __importStar(require("./web3ServiceClient"));
|
|
28
28
|
const serviceClient_1 = require("../serviceClient");
|
|
29
29
|
const WEB3_ENDPOINT = '/web3';
|
|
@@ -39,6 +39,12 @@ async function getTokenBalances(input) {
|
|
|
39
39
|
.then((res) => res.data);
|
|
40
40
|
}
|
|
41
41
|
exports.getTokenBalances = getTokenBalances;
|
|
42
|
+
async function getPortfolio(address) {
|
|
43
|
+
return serviceClient_1.baseClient
|
|
44
|
+
.get(`${WEB3_ENDPOINT}/portfolio?address=${address}`)
|
|
45
|
+
.then((res) => res.data);
|
|
46
|
+
}
|
|
47
|
+
exports.getPortfolio = getPortfolio;
|
|
42
48
|
async function getUserOpsSigner(input) {
|
|
43
49
|
return serviceClient_1.baseClient
|
|
44
50
|
.get(`${WEB3_ENDPOINT}/ops-signer/user/${input.userId}?signerType=${input.signerType}`)
|