Skip to content

Commit

Permalink
added fromEnvs constructor for the provider
Browse files Browse the repository at this point in the history
  • Loading branch information
mpsc0x committed Nov 6, 2024
1 parent 35a5ae4 commit acfec4a
Show file tree
Hide file tree
Showing 7 changed files with 458 additions and 232 deletions.
4 changes: 2 additions & 2 deletions examples/admin/mintUnderlyings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { Account, AccountAddress, Ed25519PrivateKey } from "@aptos-labs/ts-sdk";
import { UnderlyingTokensClient } from "../../src/clients/underlyingTokensClient";
import { PoolClient } from "../../src/clients/poolClient";
import { AptosProvider } from "../../src/clients";
import { testnetConfig } from "../../src/configs/testnet";
import { DEFAULT_TESTNET_CONFIG } from "../../src/configs/testnet";

const UNDERLYING_MANAGER_PRIVATE_KEY = "0x0";
const ADDRESSES_TO_FUND = ["0x0"].map((addr) =>
Expand All @@ -12,7 +12,7 @@ const fundAmount = BigInt(1000);

(async () => {
// global aptos provider
const aptosProvider = AptosProvider.fromConfig(testnetConfig);
const aptosProvider = AptosProvider.fromConfig(DEFAULT_TESTNET_CONFIG);
// all underlying-tokens-related operations client
const underlyingTokensClient = new UnderlyingTokensClient(aptosProvider);
// all pool-related operations client
Expand Down
4 changes: 2 additions & 2 deletions examples/admin/setAssetPrices.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import dotenv from "dotenv";
import { Account, Ed25519PrivateKey } from "@aptos-labs/ts-sdk";
import { OracleClient, PoolClient } from "../../src/clients";
import { AptosProvider } from "../../src/clients/aptosProvider";
import { testnetConfig } from "../../src/configs/testnet";
import { DEFAULT_TESTNET_CONFIG } from "../../src/configs/testnet";

dotenv.config();

Expand All @@ -15,7 +15,7 @@ const priceMapper = {

(async () => {
// global aptos provider
const aptosProvider = AptosProvider.fromConfig(testnetConfig);
const aptosProvider = AptosProvider.fromConfig(DEFAULT_TESTNET_CONFIG);

if (!process.env.AAVE_MOCK_ORACLE_PRIVATE_KEY) {
throw new Error(`AAVE_MOCK_ORACLE_PRIVATE_KEY env was not found`);
Expand Down
4 changes: 2 additions & 2 deletions examples/quiries/getAptos.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import { Account, AccountAddress, Ed25519PrivateKey } from "@aptos-labs/ts-sdk";
import { AptosProvider } from "../../src/clients";
import { testnetConfig } from "../../src/configs/testnet";
import { DEFAULT_TESTNET_CONFIG } from "../../src/configs/testnet";

const aptFunderPrivateKey = "0x0";
const addressesToFund = ["0x0"].map((addr) => AccountAddress.fromString(addr));
const fundAmount = BigInt(0.5);

(async () => {
// global aptos provider
const aptosProvider = AptosProvider.fromConfig(testnetConfig);
const aptosProvider = AptosProvider.fromConfig(DEFAULT_TESTNET_CONFIG);

try {
// set the tx sender
Expand Down
4 changes: 2 additions & 2 deletions examples/quiries/getUserData.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@ import { UnderlyingTokensClient } from "../../src/clients/underlyingTokensClient
import { UiPoolDataProviderClient } from "../../src/clients/uiPoolDataProvider";
import { PoolClient } from "../../src/clients/poolClient";
import { AptosProvider } from "../../src/clients/aptosProvider";
import { testnetConfig } from "../../src/configs/testnet";
import { DEFAULT_TESTNET_CONFIG } from "../../src/configs/testnet";

const USER_APTOS_ACCOUNT = "0x0";

(async () => {
// global aptos provider
const aptosProvider = AptosProvider.fromConfig(testnetConfig);
const aptosProvider = AptosProvider.fromConfig(DEFAULT_TESTNET_CONFIG);

const uiPoolDataProviderClient = new UiPoolDataProviderClient(aptosProvider);
const poolClient = new PoolClient(aptosProvider);
Expand Down
14 changes: 7 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -79,11 +79,11 @@
"devDependencies": {
"@types/bn.js": "^5.1.6",
"@types/jest": "^29.5.14",
"@types/node": "^22.8.6",
"@typescript-eslint/eslint-plugin": "^8.12.2",
"@typescript-eslint/parser": "^8.12.2",
"@types/node": "^22.9.0",
"@typescript-eslint/eslint-plugin": "^8.13.0",
"@typescript-eslint/parser": "^8.13.0",
"chalk": "^5.3.0",
"eslint": "^9.13.0",
"eslint": "^9.14.0",
"eslint-config-airbnb-base": "^15.0.0",
"eslint-config-airbnb-typescript": "^18.0.0",
"eslint-config-prettier": "^9.1.0",
Expand All @@ -98,7 +98,7 @@
"jsdom": "^25.0.1",
"node-ts": "^6.1.3",
"npm-run-all": "^4.1.5",
"ora": "^8.1.0",
"ora": "^8.1.1",
"prettier": "^3.3.3",
"prettier-eslint": "^16.3.0",
"prettier-standard": "^16.4.1",
Expand All @@ -108,12 +108,12 @@
"ts-node": "^10.9.2",
"typedoc": "^0.26.11",
"typescript": "^5.6.3",
"typescript-eslint": "^8.12.2",
"typescript-eslint": "^8.13.0",
"webpack": "^5.96.1",
"webpack-cli": "^5.1.4"
},
"optionalDependencies": {
"bufferutil": "^4.0.8",
"utf-8-validate": "^6.0.4"
"utf-8-validate": "^6.0.5"
}
}
Loading

0 comments on commit acfec4a

Please sign in to comment.