diff --git a/README.md b/README.md index 60ed0a83..3ac32a5e 100644 --- a/README.md +++ b/README.md @@ -292,3 +292,18 @@ Pro Tips * specify which port to run on * and more! + +Env variables +======== +```text +NEAR_CLI_MAINNET_RPC_SERVER_URL +NEAR_CLI_TESTNET_RPC_SERVER_URL +``` +Clear them in case you want to get back to the default RPC server. + +Example: + +```shell +export NEAR_CLI_MAINNET_RPC_SERVER_URL= +``` +here is a testcase: [jsonrpc.ava.js](./packages/js/__tests__/jsonrpc.ava.js) diff --git a/packages/js/__tests__/jsonrpc.ava.js b/packages/js/__tests__/jsonrpc.ava.js new file mode 100644 index 00000000..1e826f42 --- /dev/null +++ b/packages/js/__tests__/jsonrpc.ava.js @@ -0,0 +1,13 @@ +import process from 'process'; + +import test from 'ava'; + +import {JsonRpcProvider} from '..'; + +test('check url', t => { + const provider = JsonRpcProvider.fromNetwork('mainnet'); + if (process.env.NEAR_CLI_MAINNET_RPC_SERVER_URL) { + console.log('use rpc', process.env.NEAR_CLI_MAINNET_RPC_SERVER_URL); + t.is(provider.connection.url, process.env.NEAR_CLI_MAINNET_RPC_SERVER_URL.toString()); + } +}); diff --git a/packages/js/dist/jsonrpc.d.ts.map b/packages/js/dist/jsonrpc.d.ts.map index 29ebbbb9..66d89559 100644 --- a/packages/js/dist/jsonrpc.d.ts.map +++ b/packages/js/dist/jsonrpc.d.ts.map @@ -1 +1 @@ -{"version":3,"file":"jsonrpc.d.ts","sourceRoot":"","sources":["../src/jsonrpc.ts"],"names":[],"mappings":";AACA,OAAO,EAAC,MAAM,EAAC,MAAM,QAAQ,CAAC;AAG9B,OAAO,EAAC,OAAO,EAAC,MAAM,UAAU,CAAC;AACjC,OAAO,EAAC,OAAO,EAAoB,WAAW,EAAE,kBAAkB,EAAE,cAAc,EAAE,UAAU,EAAmB,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAoB,KAAK,EAAoB,SAAS,EAAE,OAAO,EAAE,aAAa,EAAE,aAAa,EAAC,MAAM,SAAS,CAAC;A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AAC"} \ No newline at end of file diff --git a/packages/js/dist/jsonrpc.js b/packages/js/dist/jsonrpc.js index d26742b0..6a2a0aae 100644 --- a/packages/js/dist/jsonrpc.js +++ b/packages/js/dist/jsonrpc.js @@ -1,8 +1,12 @@ "use strict"; +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; Object.defineProperty(exports, "__esModule", { value: true }); exports.MainnetRpc = exports.TestnetRpc = exports.JsonRpcProvider = void 0; // eslint-disable unicorn/no-object-as-default-parameter const buffer_1 = require("buffer"); +const process_1 = __importDefault(require("process")); const near_units_1 = require("near-units"); const transaction_1 = require("near-api-js/lib/transaction"); const types_1 = require("./types"); @@ -26,8 +30,8 @@ class JsonRpcProvider extends types_1.JSONRpc { } static fromNetwork(network) { switch (network) { - case 'mainnet': return exports.MainnetRpc; - case 'testnet': return exports.TestnetRpc; + case 'mainnet': return process_1.default.env.NEAR_CLI_MAINNET_RPC_SERVER_URL ? JsonRpcProvider.from(process_1.default.env.NEAR_CLI_MAINNET_RPC_SERVER_URL) : exports.MainnetRpc; + case 'testnet': return process_1.default.env.NEAR_CLI_TESTNET_RPC_SERVER_URL ? JsonRpcProvider.from(process_1.default.env.NEAR_CLI_TESTNET_RPC_SERVER_URL) : exports.TestnetRpc; default: throw new TypeError('Invalid network only mainnet or testnet'); } } diff --git a/packages/js/dist/jsonrpc.js.map b/packages/js/dist/jsonrpc.js.map index 132f7971..2c9657f9 100644 --- a/packages/js/dist/jsonrpc.js.map +++ b/packages/js/dist/jsonrpc.js.map @@ -1 +1 @@ -{"version":3,"file":"jsonrpc.js","sourceRoot":"","sources":["../src/jsonrpc.ts"],"names":[],"mappings":";;;AAAA,wDAAwD;AACxD,mCAA8B;AAC9B,2CAAgC;AAChC,6DAAiE;AAEjE,mCAA2P;AAE3P,MAAM,UAAU,GAA6B,EAAC,QAAQ,EAAE,YAAY,EAAC,CAAC;AACtE;;;GAGG;AACH,MAAa,eAAgB,SAAQ,eA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S,GAAiC,IAAI,GAAG,EAAE,CAAC;AA6KjE,QAAA,UAAU,GAAG,eAAe,CAAC,IAAI,CAAC,wBAAgB,CAAC,CAAC;AACpD,QAAA,UAAU,GAAG,eAAe,CAAC,IAAI,CAAC,wBAAgB,CAAC,CAAC"} \ No newline at end of file diff --git a/packages/js/dist/transaction.d.ts.map b/packages/js/dist/transaction.d.ts.map index fa368ee1..64facd6c 100644 --- a/packages/js/dist/transaction.d.ts.map +++ b/packages/js/dist/transaction.d.ts.map @@ -1 +1 @@ -{"version":3,"file":"transaction.d.ts","sourceRoot":"","sources":["../src/transaction.ts"],"names":[],"mappings":";AAAA,OAAO,EAAC,MAAM,EAAC,MAAM,QAAQ,CAAC;AAE9B,OAAO,EAAC,GAAG,EAAC,MAAM,KAAK,CAAC;AACxB,OAAO,EAAC,IAAI,EAAC,MAAM,YAAY,CAAC;AAChC,OAAO,EAAC,iBAAiB,EAAC,MAAM,sBAAsB,CAAC;AACvD,OAAO,EACL,MAAM,EACN,SAAS,EACT,SAAS,EAUT,EAAE,EAEF,OAAO,EACP,YAAY,EACb,MAAM,SAAS,CAAC;AAIjB,8BAAsB,WAAW;IAC/B,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,OAAO,EAAE,MAAM,EAAE,CAAM;IAChC,OAAO,CAAC,kBAAkB,CAAS;IACnC,OAAO,CAAC,eAAe,CAAC,CAAO;gBAEnB,MAAM,EAAE,YAAY,GAAG,MAAM,EAAE,QAAQ,EAAE,YAAY,GAAG,MAAM;IAK1E,MAAM,CAAC,SAAS,EAAE,MAAM,GAAG,SAAS,EAAE,SAAS,GAAE,SAA2B,GAAG,IAAI;IAKnF,aAAa,IAAI,IAAI;IAMrB,aAAa,CAAC,aAAa,EAAE,MAAM,GAAG,IAAI;IAK1C,SAAS,CAAC,SAAS,EAAE,MAAM,GAAG,SAAS,GAAG,IAAI;IAK9C;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/packages/js/dist/transaction.js b/packages/js/dist/transaction.js index 40efc816..fb27aa83 100644 --- a/packages/js/dist/transaction.js +++ b/packages/js/dist/transaction.js @@ -63,7 +63,9 @@ class Transaction { this.actions.push((0, types_1.deployContract)(code)); return this; } - functionCall(methodName, args, { gas = types_1.DEFAULT_FUNCTION_CALL_GAS, attachedDeposit = utils_1.NO_DEPOSIT, } = {}) { + functionCall(methodName, args, { + // @typescript-eslint/no-unsafe-assignment + gas = types_1.DEFAULT_FUNCTION_CALL_GAS, attachedDeposit = utils_1.NO_DEPOSIT, } = {}) { this.actions.push((0, types_1.functionCall)(methodName, args, (0, utils_1.parseGas)(gas), (0, utils_1.parseNEAR)(attachedDeposit))); return this; } diff --git a/packages/js/dist/transaction.js.map b/packages/js/dist/transaction.js.map index 82f271d5..a8cde530 100644 --- a/packages/js/dist/transaction.js.map +++ b/packages/js/dist/transaction.js.map @@ -1 +1 @@ -{"version":3,"file":"transaction.js","sourceRoot":"","sources":["../src/transaction.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;AACA,gDAAkC;AAElC,2CAAgC;AAEhC,mCAiBiB;AACjB,qDAAsD;AACtD,mCAAwD;AAExD,MAAsB,WAAW;IAO/B,YAAY,MAA6B,EAAE,QAA+B;QAJjE,YAAO,GAAa,EAAE,CAAC;QACxB,uBAAkB,GAAG,KAAK,CAAC;QAIjC,IAAI,CAAC,QAAQ,GAAG,OAAO,MAAM,KAAK,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,SAAS,CAAC;QACvE,IAAI,CAAC,UAAU,GAAG,OAAO,QAAQ,KAAK,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC,SAAS,CAAC;IACjF,CAAC;IAED,MAAM,CAAC,SAA6B,EAAE,YAAuB,IAAA,qBAAa,GAAE;QAC1E,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,IAAA,cAAM,EAAC,iBAAS,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AAED;;;;GAIG;AACH,wBAAgB,YAAY,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,CAI9D;AAED,eAAO,MAAM,mBAAmB,qCAAqC,CAAC;AAEtE;;;GAGG;AACH,wBAAgB,iBAAiB,IAAI,SAAS,GAAG,SAAS,CAczD;AAED,wBAAgB,YAAY,IAAI,QAAQ,CAIvC;AAED,wBAAgB,UAAU,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,SAAI,GAAG,MAAM,CAE7D;AAID,wBAAgB,QAAQ,CAAC,CAAC,EAAE,MAAM,GAAG,EAAE,GAAG,GAAG,CAM5C;AAID,wBAAgB,SAAS,CAAC,CAAC,EAAE,MAAM,GAAG,EAAE,GAAG,IAAI,CAM9C"} \ No newline at end of file diff --git a/packages/js/dist/utils.js b/packages/js/dist/utils.js index d44f8b8f..e0b48ab0 100644 --- a/packages/js/dist/utils.js +++ b/packages/js/dist/utils.js @@ -75,9 +75,16 @@ function isTopLevelAccount(accountId) { } exports.isTopLevelAccount = isTopLevelAccount; function configFromDomain(network) { + let rpcAddr = `https://archival-rpc.${network}.near.org`; + if (network === 'mainnet' && process.env.NEAR_CLI_MAINNET_RPC_SERVER_URL) { + rpcAddr = process.env.NEAR_CLI_MAINNET_RPC_SERVER_URL; + } + else if (network === 'testnet' && process.env.NEAR_CLI_TESTNET_RPC_SERVER_URL) { + rpcAddr = process.env.NEAR_CLI_TESTNET_RPC_SERVER_URL; + } return { network, - rpcAddr: `https://archival-rpc.${network}.near.org`, + rpcAddr, walletUrl: `https://wallet.${network}.near.org`, helperUrl: `https://helper.${network}.near.org`, explorerUrl: `https://explorer.${network}.near.org`, diff --git a/packages/js/dist/utils.js.map b/packages/js/dist/utils.js.map index e3ec5858..06fd15f1 100644 --- a/packages/js/dist/utils.js.map +++ b/packages/js/dist/utils.js.map @@ -1 +1 @@ -{"version":3,"file":"utils.js","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;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AAI,OAAO,CAAC,KAAK,QAAQ,IAAI,uBAAuB,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE;QAC5D,OAAO,iBAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;KACtB;IAED,OAAO,iBAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AACtB,CAAC;AAND,8BAMC"} \ No newline at end of file diff --git a/packages/js/package.json b/packages/js/package.json index d2dd63dc..12af148f 100644 --- a/packages/js/package.json +++ b/packages/js/package.json @@ -40,7 +40,8 @@ "test:sandbox": "yarn build && ava --verbose", "test:sandbox:ci": "yarn build && NEAR_WORKSPACES_DEBUG=true ava --verbose", "test": "ava --verbose && yarn test:testnet", - "clean:accounts": "ts-node ./scripts/delete-accounts.ts" + "clean:accounts": "ts-node ./scripts/delete-accounts.ts", + "test:jsonrpc:env": " NEAR_CLI_MAINNET_RPC_SERVER_URL=https://near-mainnet.api.pagoda.co/rpc/v1 ava __tests__/jsonrpc.ava.js" }, "files": [ "dist/", diff --git a/packages/js/src/jsonrpc.ts b/packages/js/src/jsonrpc.ts index dcb4e39d..e352f58f 100644 --- a/packages/js/src/jsonrpc.ts +++ b/packages/js/src/jsonrpc.ts @@ -1,5 +1,6 @@ // eslint-disable unicorn/no-object-as-default-parameter import {Buffer} from 'buffer'; +import process from 'process'; import {NEAR} from 'near-units'; import {stringifyJsonOrBytes} from 'near-api-js/lib/transaction'; import {Records} from './record'; @@ -29,8 +30,8 @@ export class JsonRpcProvider extends JSONRpc { static fromNetwork(network: Network): JsonRpcProvider { switch (network) { - case 'mainnet': return MainnetRpc; - case 'testnet': return TestnetRpc; + case 'mainnet': return process.env.NEAR_CLI_MAINNET_RPC_SERVER_URL ? JsonRpcProvider.from(process.env.NEAR_CLI_MAINNET_RPC_SERVER_URL) : MainnetRpc; + case 'testnet': return process.env.NEAR_CLI_TESTNET_RPC_SERVER_URL ? JsonRpcProvider.from(process.env.NEAR_CLI_TESTNET_RPC_SERVER_URL) : TestnetRpc; default: throw new TypeError('Invalid network only mainnet or testnet'); } } diff --git a/packages/js/src/transaction.ts b/packages/js/src/transaction.ts index b7780387..2d8e04fa 100644 --- a/packages/js/src/transaction.ts +++ b/packages/js/src/transaction.ts @@ -80,6 +80,7 @@ export abstract class Transaction { methodName: string, args: Record | Uint8Array, { + // @typescript-eslint/no-unsafe-assignment gas = DEFAULT_FUNCTION_CALL_GAS, attachedDeposit = NO_DEPOSIT, }: {gas?: BN | string; attachedDeposit?: BN | string} = {}, diff --git a/packages/js/src/utils.ts b/packages/js/src/utils.ts index d5c199e3..3dd5a7d3 100644 --- a/packages/js/src/utils.ts +++ b/packages/js/src/utils.ts @@ -57,9 +57,16 @@ export function isTopLevelAccount(accountId: string): boolean { } function configFromDomain(network: 'testnet' | 'mainnet'): ClientConfig { + let rpcAddr = `https://archival-rpc.${network}.near.org`; + if (network === 'mainnet' && process.env.NEAR_CLI_MAINNET_RPC_SERVER_URL) { + rpcAddr = process.env.NEAR_CLI_MAINNET_RPC_SERVER_URL; + } else if (network === 'testnet' && process.env.NEAR_CLI_TESTNET_RPC_SERVER_URL) { + rpcAddr = process.env.NEAR_CLI_TESTNET_RPC_SERVER_URL; + } + return { network, - rpcAddr: `https://archival-rpc.${network}.near.org`, + rpcAddr, walletUrl: `https://wallet.${network}.near.org`, helperUrl: `https://helper.${network}.near.org`, explorerUrl: `https://explorer.${network}.near.org`,