@galacticcouncil/sdk-next 0.1.0 → 0.3.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 +101 -128
- package/build/index.cjs +1 -1
- package/build/index.mjs +1 -1
- package/build/types/aave/AaveClient.d.ts +76 -0
- package/build/types/aave/AaveUtils.d.ts +58 -0
- package/build/types/aave/abi/AavePool.d.ts +208 -0
- package/build/types/aave/abi/AavePoolDataProvider.d.ts +384 -0
- package/build/types/aave/abi/index.d.ts +2 -0
- package/build/types/aave/const.d.ts +6 -0
- package/build/types/aave/index.d.ts +4 -0
- package/build/types/aave/types.d.ts +15 -0
- package/build/types/api/Papi.d.ts +4 -381
- package/build/types/api/index.d.ts +1 -1
- package/build/types/api/utils.d.ts +1 -0
- package/build/types/client/ChainParams.d.ts +9 -0
- package/build/types/client/index.d.ts +1 -0
- package/build/types/evm/chain.d.ts +2 -0
- package/build/types/evm/client.d.ts +12 -0
- package/build/types/evm/index.d.ts +2 -0
- package/build/types/factory.d.ts +25 -0
- package/build/types/index.d.ts +4 -0
- package/build/types/sor/TradeRouteBuilder.d.ts +4 -0
- package/build/types/sor/TradeScheduler.d.ts +95 -0
- package/build/types/sor/const.d.ts +7 -0
- package/build/types/sor/index.d.ts +2 -1
- package/build/types/sor/types.d.ts +43 -4
- package/build/types/tx/OrderTxBuilder.d.ts +21 -0
- package/build/types/tx/TradeTxBuilder.d.ts +18 -0
- package/build/types/tx/TxBuilder.d.ts +17 -0
- package/build/types/tx/TxBuilderFactory.d.ts +12 -0
- package/build/types/tx/index.d.ts +2 -0
- package/build/types/tx/types.d.ts +12 -0
- package/build/types/tx/utils.d.ts +6 -0
- package/build/types/utils/big.d.ts +2 -1
- package/build/types/utils/erc20.d.ts +3 -3
- package/build/types/utils/h160.d.ts +9 -0
- package/build/types/utils/index.d.ts +1 -1
- package/package.json +2 -2
- package/build/types/sor/TradeUtils.d.ts +0 -12
- package/build/types/utils/evm.d.ts +0 -3
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { TradeOrder } from '../sor';
|
|
2
|
+
import { TxBuilder } from './TxBuilder';
|
|
3
|
+
import { Tx } from './types';
|
|
4
|
+
export declare class OrderTxBuilder extends TxBuilder {
|
|
5
|
+
private _order?;
|
|
6
|
+
private _beneficiary?;
|
|
7
|
+
private _maxRetries;
|
|
8
|
+
private _slippagePct;
|
|
9
|
+
setOrder(order: TradeOrder): this;
|
|
10
|
+
withBeneficiary(beneficiary: string): this;
|
|
11
|
+
withMaxRetries(maxRetries: number): this;
|
|
12
|
+
withSlippage(slippage: number): this;
|
|
13
|
+
private get order();
|
|
14
|
+
private get beneficiary();
|
|
15
|
+
private get maxRetries();
|
|
16
|
+
private get slippagePct();
|
|
17
|
+
build(): Promise<Tx>;
|
|
18
|
+
private buildDcaTx;
|
|
19
|
+
private buildTwapSellTx;
|
|
20
|
+
private buildTwapBuyTx;
|
|
21
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { Trade } from '../sor';
|
|
2
|
+
import { TxBuilder } from './TxBuilder';
|
|
3
|
+
import { Tx } from './types';
|
|
4
|
+
export declare class TradeTxBuilder extends TxBuilder {
|
|
5
|
+
private _trade?;
|
|
6
|
+
private _beneficiary?;
|
|
7
|
+
private _slippagePct;
|
|
8
|
+
setTrade(trade: Trade): this;
|
|
9
|
+
withBeneficiary(beneficiary: string): this;
|
|
10
|
+
withSlippage(slippage: number): this;
|
|
11
|
+
private get trade();
|
|
12
|
+
private get beneficiary();
|
|
13
|
+
private get slippagePct();
|
|
14
|
+
build(): Promise<Tx>;
|
|
15
|
+
private buildBuyTx;
|
|
16
|
+
private buildSellTx;
|
|
17
|
+
private buildSellAllTx;
|
|
18
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { PolkadotClient } from 'polkadot-api';
|
|
2
|
+
import { AaveUtils } from '../aave';
|
|
3
|
+
import { Papi } from '../api';
|
|
4
|
+
import { BalanceClient } from '../client';
|
|
5
|
+
import { EvmClient } from '../evm';
|
|
6
|
+
import { Swap } from '../sor';
|
|
7
|
+
import { DryRunResult, Transaction, Tx } from './types';
|
|
8
|
+
export declare abstract class TxBuilder extends Papi {
|
|
9
|
+
protected readonly evmClient: EvmClient;
|
|
10
|
+
protected readonly balanceClient: BalanceClient;
|
|
11
|
+
protected readonly aaveUtils: AaveUtils;
|
|
12
|
+
constructor(client: PolkadotClient, evmClient?: EvmClient);
|
|
13
|
+
protected wrapTx(name: string, tx: Transaction): Tx;
|
|
14
|
+
protected dispatchWithExtraGas(tx: Transaction): Promise<Transaction>;
|
|
15
|
+
protected dryRun(account: string, tx: Transaction): Promise<DryRunResult>;
|
|
16
|
+
protected isDirectOmnipoolTrade(swaps: Swap[]): boolean;
|
|
17
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { PolkadotClient } from 'polkadot-api';
|
|
2
|
+
import { EvmClient } from '../evm';
|
|
3
|
+
import { Trade, TradeOrder } from '../sor';
|
|
4
|
+
import { TradeTxBuilder } from './TradeTxBuilder';
|
|
5
|
+
import { OrderTxBuilder } from './OrderTxBuilder';
|
|
6
|
+
export declare class TxBuilderFactory {
|
|
7
|
+
private client;
|
|
8
|
+
private evmClient;
|
|
9
|
+
constructor(client: PolkadotClient, evmClient?: EvmClient);
|
|
10
|
+
trade(trade: Trade): TradeTxBuilder;
|
|
11
|
+
order(order: TradeOrder): OrderTxBuilder;
|
|
12
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Transaction as SafeTransaction, UnsafeTransaction } from 'polkadot-api';
|
|
2
|
+
import { HydrationApis } from '@galacticcouncil/descriptors';
|
|
3
|
+
export interface Tx {
|
|
4
|
+
name?: string;
|
|
5
|
+
get(): Transaction;
|
|
6
|
+
dryRun(account: string): Promise<DryRunResult>;
|
|
7
|
+
}
|
|
8
|
+
export type SafeTx = SafeTransaction<any, string, string, void | undefined>;
|
|
9
|
+
export type UnsafeTx = UnsafeTransaction<any, string, string, void | undefined>;
|
|
10
|
+
export type Transaction = SafeTx | UnsafeTx;
|
|
11
|
+
export type DryRunResult = HydrationApis['DryRunApi']['dry_run_call']['Value'];
|
|
12
|
+
export type DryRunArgs = HydrationApis['DryRunApi']['dry_run_call']['Args'];
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
-
import { RoundingMode } from 'big.js';
|
|
1
|
+
import Big, { RoundingMode } from 'big.js';
|
|
2
2
|
export declare function toDecimal(amount: bigint, decimals: number, maxDecimal?: number, roundType?: RoundingMode): string;
|
|
3
3
|
export declare function toBigInt(amount: string | number, decimals: number): bigint;
|
|
4
|
+
export declare function asBigInt(value: Big): bigint;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export declare class
|
|
2
|
-
static
|
|
3
|
-
static
|
|
1
|
+
export declare class ERC20 {
|
|
2
|
+
static fromAssetId(assetId: number): string;
|
|
3
|
+
static toAssetId(address: string): number | null;
|
|
4
4
|
static isAssetAddress(address: string): boolean;
|
|
5
5
|
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export declare function isEvmAccount(ss58addr: string): boolean;
|
|
2
|
+
export declare function isEvmAddress(address: string): boolean;
|
|
3
|
+
export declare function isSs58Address(address: string): boolean;
|
|
4
|
+
export declare class H160 {
|
|
5
|
+
static toAccount: (address: string) => import("polkadot-api").SS58String;
|
|
6
|
+
static fromAccount: (address: string) => string;
|
|
7
|
+
static fromSS58: (address: string) => string;
|
|
8
|
+
static fromAny: (address: string) => string;
|
|
9
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@galacticcouncil/sdk-next",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"description": "Galactic next gen sdk (papi)",
|
|
5
5
|
"author": "GalacticCouncil",
|
|
6
6
|
"repository": {
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
"@types/big.js": "^6.2.2"
|
|
36
36
|
},
|
|
37
37
|
"dependencies": {
|
|
38
|
-
"@galacticcouncil/descriptors": "^1.
|
|
38
|
+
"@galacticcouncil/descriptors": "^1.2.0",
|
|
39
39
|
"@galacticcouncil/math-lbp": "^1.1.0",
|
|
40
40
|
"@galacticcouncil/math-liquidity-mining": "^1.1.0",
|
|
41
41
|
"@galacticcouncil/math-omnipool": "^1.2.0",
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { Binary, PolkadotClient } from 'polkadot-api';
|
|
2
|
-
import { Papi } from '../api';
|
|
3
|
-
import { Trade } from './types';
|
|
4
|
-
export declare class TradeUtils extends Papi {
|
|
5
|
-
constructor(client: PolkadotClient);
|
|
6
|
-
private isDirectOmnipoolTrade;
|
|
7
|
-
private tradeCheck;
|
|
8
|
-
buildBuyTx(trade: Trade, slippagePct?: number): Promise<Binary>;
|
|
9
|
-
buildSellTx(trade: Trade, slippagePct?: number): Promise<Binary>;
|
|
10
|
-
buildSellAllTx(trade: Trade, slippagePct?: number): Promise<Binary>;
|
|
11
|
-
private buildRoute;
|
|
12
|
-
}
|