Skip to content

Commit

Permalink
Merge pull request #53 from pontem-network/feat-ls-2155-indexer
Browse files Browse the repository at this point in the history
[feat-ls-2155-indexer]: update config
  • Loading branch information
extg5 authored Aug 19, 2024
2 parents 4b753db + a7ef6d5 commit fae3b53
Show file tree
Hide file tree
Showing 5 changed files with 261 additions and 33 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/deploy-gh-pages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: '12'
node-version: '18'
cache: 'yarn'
- run: yarn install
- run: yarn docs
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/lint-and-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ jobs:
strategy:
fail-fast: false
matrix:
nodejs: [12, 14]
nodejs: [18]

steps:
- uses: actions/checkout@v2
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@pontem/liquidswap-sdk",
"version": "0.7.1",
"version": "0.7.2",
"description": "SDK to use LiquidSwap functions",
"author": "Igor Demko <[email protected]>",
"repository": "https://github.com/pontem-network/liquidswap-sdk",
Expand Down Expand Up @@ -45,7 +45,7 @@
"typescript": "^4.6.3"
},
"dependencies": {
"aptos": "^1.3.17",
"aptos": "1.21.0",
"axios": "^0.27.2",
"decimal.js": "^10.4.1"
},
Expand Down
31 changes: 21 additions & 10 deletions src/sdk.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,15 @@
import { AptosClient } from 'aptos';
import { AptosClient, ClientConfig } from 'aptos';
import { SwapModule } from './modules/SwapModule';
import { ResourcesModule } from './modules/ResourcesModule';
import { AptosResourceType } from './types/aptos';
import { LiquidityModule } from './modules/LiquidityModule';
import { NETWORKS_MODULES, MODULES_ACCOUNT, RESOURCES_ACCOUNT, MODULES_V05_ACCOUNT, RESOURCES_V05_ACCOUNT } from './constants';
import {
NETWORKS_MODULES,
MODULES_ACCOUNT,
RESOURCES_ACCOUNT,
MODULES_V05_ACCOUNT,
RESOURCES_V05_ACCOUNT,
} from './constants';

const initialNetworkOptions = {
nativeToken: '0x1::aptos_coin::AptosCoin',
Expand All @@ -15,7 +21,7 @@ const initialNetworkOptions = {
resourceAccount: RESOURCES_ACCOUNT,
moduleAccount: MODULES_ACCOUNT,
moduleAccountV05: MODULES_V05_ACCOUNT,
resourceAccountV05: RESOURCES_V05_ACCOUNT
resourceAccountV05: RESOURCES_V05_ACCOUNT,
};

interface INetworkOptions {
Expand All @@ -33,6 +39,7 @@ interface INetworkOptions {

export interface SdkOptions {
nodeUrl: string;
nodeOptions?: Partial<ClientConfig>;
networkOptions?: INetworkOptions;
}

Expand Down Expand Up @@ -85,27 +92,31 @@ export class SDK {
this._networkOptions.modules = options.networkOptions.modules;
}
if (options.networkOptions?.moduleAccount) {
this._networkOptions.moduleAccount = options.networkOptions.moduleAccount;
this._networkOptions.moduleAccount =
options.networkOptions.moduleAccount;
}
if (options.networkOptions?.resourceAccount) {
this._networkOptions.resourceAccount = options.networkOptions.resourceAccount;
this._networkOptions.resourceAccount =
options.networkOptions.resourceAccount;
}
if (options.networkOptions?.moduleAccountV05) {
this._networkOptions.moduleAccountV05 = options.networkOptions.moduleAccountV05;
this._networkOptions.moduleAccountV05 =
options.networkOptions.moduleAccountV05;
}
if (options.networkOptions?.resourceAccountV05) {
this._networkOptions.resourceAccountV05 = options.networkOptions.resourceAccountV05;
this._networkOptions.resourceAccountV05 =
options.networkOptions.resourceAccountV05;
}
}
this._client = new AptosClient(options.nodeUrl);
this._client = new AptosClient(options.nodeUrl, options.nodeOptions);
this._swap = new SwapModule(this);
this._resources = new ResourcesModule(this);
this._liquidity = new LiquidityModule(this);
this._curves = {
uncorrelated: `${this._networkOptions.moduleAccount}::curves::Uncorrelated`,
stable: `${this._networkOptions.moduleAccount}::curves::Stable`,
uncorrelatedV05: `${this._networkOptions.moduleAccountV05}::curves::Uncorrelated`,
stableV05: `${this._networkOptions.moduleAccountV05}::curves::Stable`
}
stableV05: `${this._networkOptions.moduleAccountV05}::curves::Stable`,
};
}
}
Loading

0 comments on commit fae3b53

Please sign in to comment.