mirror of
https://github.com/alexgo-io/alex-sdk.git
synced 2026-01-12 22:12:16 +08:00
feat: add pool id to PoolData
This commit is contained in:
@@ -51,6 +51,7 @@ export type PoolData = {
|
|||||||
tokenX: Currency;
|
tokenX: Currency;
|
||||||
tokenY: Currency;
|
tokenY: Currency;
|
||||||
factor: bigint;
|
factor: bigint;
|
||||||
|
poolId: bigint
|
||||||
};
|
};
|
||||||
|
|
||||||
export type PriceData = {
|
export type PriceData = {
|
||||||
|
|||||||
@@ -18,11 +18,17 @@ import {
|
|||||||
} from 'clarity-codegen';
|
} from 'clarity-codegen';
|
||||||
|
|
||||||
export async function getAlexSDKData(): Promise<AlexSDKResponse> {
|
export async function getAlexSDKData(): Promise<AlexSDKResponse> {
|
||||||
return fetch(configs.SDK_API_HOST).then((r) => {
|
return fetch(configs.SDK_API_HOST).then((r): Promise<AlexSDKResponse> => {
|
||||||
if (r.ok) {
|
if (r.ok) {
|
||||||
return r.json();
|
return r.json();
|
||||||
}
|
}
|
||||||
throw new Error('Failed to fetch token mappings');
|
throw new Error('Failed to fetch token mappings');
|
||||||
|
}).then(x => {
|
||||||
|
for (const a of x.pools) {
|
||||||
|
a.poolId = BigInt(a.poolId)
|
||||||
|
a.factor = BigInt(a.factor)
|
||||||
|
}
|
||||||
|
return x
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -108,5 +108,6 @@ function toPoolData(pool: string): PoolData {
|
|||||||
tokenX: tokenX as Currency,
|
tokenX: tokenX as Currency,
|
||||||
tokenY: tokenY as Currency,
|
tokenY: tokenY as Currency,
|
||||||
factor: BigInt(Number(factor) * 1e8),
|
factor: BigInt(Number(factor) * 1e8),
|
||||||
|
poolId: BigInt(0),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,6 +23,7 @@ export const dummyAmmRoute: AMMRouteSegment[] = [
|
|||||||
tokenX: dummyTokenA,
|
tokenX: dummyTokenA,
|
||||||
tokenY: dummyTokenC,
|
tokenY: dummyTokenC,
|
||||||
factor: dummyFactorA,
|
factor: dummyFactorA,
|
||||||
|
poolId: BigInt(1),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -32,6 +33,7 @@ export const dummyAmmRoute: AMMRouteSegment[] = [
|
|||||||
tokenX: dummyTokenC,
|
tokenX: dummyTokenC,
|
||||||
tokenY: dummyTokenB,
|
tokenY: dummyTokenB,
|
||||||
factor: dummyFactorB,
|
factor: dummyFactorB,
|
||||||
|
poolId: BigInt(2),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|||||||
Reference in New Issue
Block a user