@tatumio/bsc 2.0.1-alpha.203
Sign up to get free protection for your applications and to get access to all the features.
- package/package.json +28 -0
- package/src/index.d.ts +1 -0
- package/src/index.js +5 -0
- package/src/index.js.map +1 -0
- package/src/lib/bsc.sdk.d.ts +139 -0
- package/src/lib/bsc.sdk.js +28 -0
- package/src/lib/bsc.sdk.js.map +1 -0
- package/src/lib/services/bsc.kms.d.ts +10 -0
- package/src/lib/services/bsc.kms.js +34 -0
- package/src/lib/services/bsc.kms.js.map +1 -0
- package/src/lib/services/bsc.tx.d.ts +6 -0
- package/src/lib/services/bsc.tx.js +8 -0
- package/src/lib/services/bsc.tx.js.map +1 -0
- package/src/lib/services/bsc.web3.d.ts +8 -0
- package/src/lib/services/bsc.web3.js +24 -0
- package/src/lib/services/bsc.web3.js.map +1 -0
package/package.json
ADDED
@@ -0,0 +1,28 @@
|
|
1
|
+
{
|
2
|
+
"name": "@tatumio/bsc",
|
3
|
+
"version": "v2.0.1-alpha.203",
|
4
|
+
"license": "MIT",
|
5
|
+
"main": "./src/index.js",
|
6
|
+
"typings": "./src/index.d.ts",
|
7
|
+
"dependencies": {
|
8
|
+
"@tatumio/shared-testing": "v2.0.1-alpha.202",
|
9
|
+
"@tatumio/shared-blockchain-btc-based": "v2.0.1-alpha.202",
|
10
|
+
"@tatumio/shared-core": "v2.0.1-alpha.202",
|
11
|
+
"axios": "^0.24.0",
|
12
|
+
"@tatumio/api-client": "v2.0.1-alpha.202",
|
13
|
+
"cross-blob": "^3.0.0",
|
14
|
+
"form-data": "^4.0.0",
|
15
|
+
"@tatumio/shared-blockchain-abstract": "v2.0.1-alpha.202",
|
16
|
+
"@tatumio/shared-abstract-sdk": "v2.0.1-alpha.202",
|
17
|
+
"bignumber.js": "^9.0.2",
|
18
|
+
"bip32": "^2.0.5",
|
19
|
+
"bip39": "^3.0.2",
|
20
|
+
"bitcoinjs-lib": "^5.2.0",
|
21
|
+
"hdkey": "^2.0.1",
|
22
|
+
"bitcore-lib": "^8.25.25",
|
23
|
+
"@tatumio/shared-blockchain-evm-based": "v2.0.1-alpha.202",
|
24
|
+
"ethereumjs-wallet": "^1.0.2",
|
25
|
+
"web3": "^1.7.0"
|
26
|
+
},
|
27
|
+
"peerDependencies": {}
|
28
|
+
}
|
package/src/index.d.ts
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
export * from './lib/bsc.sdk';
|
package/src/index.js
ADDED
package/src/index.js.map
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../packages/blockchain/bsc/src/index.ts"],"names":[],"mappings":";;;AAAA,6DAA6B"}
|
@@ -0,0 +1,139 @@
|
|
1
|
+
import { Web3Request, Web3Response } from '@tatumio/shared-core';
|
2
|
+
import { BlockchainBscService } from '@tatumio/api-client';
|
3
|
+
import { SDKArguments } from '@tatumio/shared-abstract-sdk';
|
4
|
+
export declare const TatumBscSDK: (args: SDKArguments) => {
|
5
|
+
api: typeof BlockchainBscService;
|
6
|
+
kms: {
|
7
|
+
sign(tx: import("@tatumio/shared-core").ChainTransactionKMS, fromPrivateKey: string, provider?: string): Promise<string>;
|
8
|
+
getAllPending(signatures?: string): import("@tatumio/api-client").CancelablePromise<import("@tatumio/api-client").PendingTransaction>;
|
9
|
+
get: typeof import("@tatumio/api-client").SecurityKeyManagementSystemService.getPendingTransactionToSign;
|
10
|
+
complete: typeof import("@tatumio/api-client").SecurityKeyManagementSystemService.completePendingSignature;
|
11
|
+
delete: typeof import("@tatumio/api-client").SecurityKeyManagementSystemService.deletePendingTransactionToSign;
|
12
|
+
};
|
13
|
+
transaction: {};
|
14
|
+
httpDriver: (request: Web3Request) => Promise<Web3Response>;
|
15
|
+
blockchain: {
|
16
|
+
broadcast: typeof BlockchainBscService.bscBroadcast;
|
17
|
+
getTransactionsCount: typeof BlockchainBscService.bscGetTransactionCount;
|
18
|
+
getCurrentBlock: typeof BlockchainBscService.bscGetCurrentBlock;
|
19
|
+
getBlock: typeof BlockchainBscService.bscGetBlock;
|
20
|
+
getBlockchainAccountBalance: typeof BlockchainBscService.bscGetBalance;
|
21
|
+
get: typeof BlockchainBscService.bscGetTransaction;
|
22
|
+
estimateGas: typeof BlockchainBscService.bscEstimateGas;
|
23
|
+
};
|
24
|
+
web3Client: (provider?: string) => import("web3").default;
|
25
|
+
record: {
|
26
|
+
getLog(id: string): import("@tatumio/api-client").CancelablePromise<{
|
27
|
+
data: string;
|
28
|
+
}>;
|
29
|
+
storeLog(requestBody: import("../../../../../dist/packages/shared/blockchain/evm-based/src/lib/services/evm-based.record").RequestBodyWithoutChain): import("@tatumio/api-client").CancelablePromise<import("@tatumio/api-client").TransactionHash>;
|
30
|
+
};
|
31
|
+
getGasPriceInWei: () => Promise<string>;
|
32
|
+
wallet: {
|
33
|
+
generateAddressFromXPub(xpub: string, i: number): string;
|
34
|
+
generatePrivateKeyFromMnemonic(mnemonic: string, i: number, options?: {
|
35
|
+
testnet: boolean;
|
36
|
+
}): Promise<string>;
|
37
|
+
generateAddressFromPrivateKey(privateKey: string): string;
|
38
|
+
generateWallet(mnemonic?: string, options?: {
|
39
|
+
testnet: boolean;
|
40
|
+
}): Promise<import("@tatumio/api-client").TronWallet>;
|
41
|
+
};
|
42
|
+
offchain: {
|
43
|
+
depositAddress: {
|
44
|
+
checkExists: (address: string, index?: number) => Promise<import("@tatumio/api-client").Account>;
|
45
|
+
create: typeof import("@tatumio/api-client").OffChainAccountService.generateDepositAddress;
|
46
|
+
createMultiple: typeof import("@tatumio/api-client").OffChainAccountService.generateDepositAddressesBatch;
|
47
|
+
assign: typeof import("@tatumio/api-client").OffChainAccountService.assignAddress;
|
48
|
+
remove: typeof import("@tatumio/api-client").OffChainAccountService.removeAddress;
|
49
|
+
getByAccount: typeof import("@tatumio/api-client").OffChainAccountService.getAllDepositAddresses;
|
50
|
+
};
|
51
|
+
withdrawal: {
|
52
|
+
getAll: (status?: "InProgress" | "Done" | "Cancelled", pageSize?: number, offset?: number) => Promise<import("@tatumio/api-client").WithdrawalObject[]>;
|
53
|
+
};
|
54
|
+
storeTokenAddress: typeof import("@tatumio/api-client").OffChainBlockchainService.storeTokenAddress;
|
55
|
+
};
|
56
|
+
getExchangeRate(basePair?: import("@tatumio/shared-core").Fiat): import("@tatumio/api-client").CancelablePromise<import("@tatumio/api-client").ExchangeRate>;
|
57
|
+
storage: {
|
58
|
+
upload: typeof import("@tatumio/api-client").StorageIpfsService.storeIpfs;
|
59
|
+
get: typeof import("@tatumio/api-client").StorageIpfsService.getIpfsData;
|
60
|
+
};
|
61
|
+
subscriptions: typeof import("@tatumio/api-client").LedgerSubscriptionService;
|
62
|
+
ledger: {
|
63
|
+
customer: {
|
64
|
+
get: typeof import("@tatumio/api-client").LedgerCustomerService.getCustomerByExternalOrInternalId;
|
65
|
+
getAll: typeof import("@tatumio/api-client").LedgerCustomerService.findAllCustomers;
|
66
|
+
update: typeof import("@tatumio/api-client").LedgerCustomerService.updateCustomer;
|
67
|
+
activate: typeof import("@tatumio/api-client").LedgerCustomerService.activateCustomer;
|
68
|
+
deactivate: typeof import("@tatumio/api-client").LedgerCustomerService.deactivateCustomer;
|
69
|
+
enable: typeof import("@tatumio/api-client").LedgerCustomerService.enableCustomer;
|
70
|
+
disable: typeof import("@tatumio/api-client").LedgerCustomerService.disableCustomer;
|
71
|
+
};
|
72
|
+
orderBook: {
|
73
|
+
getHistorical: typeof import("@tatumio/api-client").LedgerOrderBookService.getHistoricalTradesBody;
|
74
|
+
getActiveBuyTrades: typeof import("@tatumio/api-client").LedgerOrderBookService.getBuyTradesBody;
|
75
|
+
getActiveSellTrades: typeof import("@tatumio/api-client").LedgerOrderBookService.getBuyTradesBody;
|
76
|
+
newTrade: typeof import("@tatumio/api-client").LedgerOrderBookService.storeTrade;
|
77
|
+
get: typeof import("@tatumio/api-client").LedgerOrderBookService.getTradeById;
|
78
|
+
cancel: typeof import("@tatumio/api-client").LedgerOrderBookService.deleteTrade;
|
79
|
+
cancelByAccount: typeof import("@tatumio/api-client").LedgerOrderBookService.deleteAccountTrades;
|
80
|
+
};
|
81
|
+
transaction: {
|
82
|
+
send: typeof import("@tatumio/api-client").LedgerTransactionService.sendTransaction;
|
83
|
+
sendMultiple: typeof import("@tatumio/api-client").LedgerTransactionService.sendTransactionBatch;
|
84
|
+
getAll: typeof import("@tatumio/api-client").LedgerTransactionService.getTransactions;
|
85
|
+
getAllByAccount: typeof import("@tatumio/api-client").LedgerTransactionService.getTransactionsByAccountId;
|
86
|
+
getAllByCustomer: typeof import("@tatumio/api-client").LedgerTransactionService.getTransactionsByCustomerId;
|
87
|
+
getAllByReference: typeof import("@tatumio/api-client").LedgerTransactionService.getTransactionsByReference;
|
88
|
+
countByAccount: (filter: import("@tatumio/api-client").TransactionFilter) => any;
|
89
|
+
countByCustomer: (filter: import("@tatumio/api-client").TransactionFilterCustomer) => any;
|
90
|
+
};
|
91
|
+
virtualCurrency: {
|
92
|
+
create: typeof import("@tatumio/api-client").LedgerVirtualCurrencyService.createCurrency;
|
93
|
+
mint: typeof import("@tatumio/api-client").LedgerVirtualCurrencyService.mintCurrency;
|
94
|
+
revoke: typeof import("@tatumio/api-client").LedgerVirtualCurrencyService.revokeCurrency;
|
95
|
+
getByName: typeof import("@tatumio/api-client").LedgerVirtualCurrencyService.getCurrency;
|
96
|
+
update: typeof import("@tatumio/api-client").LedgerVirtualCurrencyService.updateCurrency;
|
97
|
+
};
|
98
|
+
blockAmount: {
|
99
|
+
block: typeof import("@tatumio/api-client").LedgerAccountService.blockAmount;
|
100
|
+
unblock: typeof import("@tatumio/api-client").LedgerAccountService.deleteBlockAmount;
|
101
|
+
unblockWithTransaction: typeof import("@tatumio/api-client").LedgerAccountService.unblockAmountWithTransaction;
|
102
|
+
};
|
103
|
+
account: {
|
104
|
+
get: typeof import("@tatumio/api-client").LedgerAccountService.getAccountByAccountId;
|
105
|
+
getAll: typeof import("@tatumio/api-client").LedgerAccountService.getAllAccounts;
|
106
|
+
getByCustomerId: typeof import("@tatumio/api-client").LedgerAccountService.getAccountsByCustomerId;
|
107
|
+
getBalance: typeof import("@tatumio/api-client").LedgerAccountService.getAccountBalance;
|
108
|
+
create: typeof import("@tatumio/api-client").LedgerAccountService.createAccount;
|
109
|
+
createMultiple: typeof import("@tatumio/api-client").LedgerAccountService.createAccountBatch;
|
110
|
+
update: typeof import("@tatumio/api-client").LedgerAccountService.updateAccountByAccountId;
|
111
|
+
getBlockedAmountsByAccountId: typeof import("@tatumio/api-client").LedgerAccountService.getBlockAmountById;
|
112
|
+
activate: typeof import("@tatumio/api-client").LedgerAccountService.activateAccount;
|
113
|
+
deactivate: typeof import("@tatumio/api-client").LedgerAccountService.deactivateAccount;
|
114
|
+
freeze: typeof import("@tatumio/api-client").LedgerAccountService.freezeAccount;
|
115
|
+
unfreeze: typeof import("@tatumio/api-client").LedgerAccountService.unfreezeAccount;
|
116
|
+
generate: (account: import("@tatumio/api-client").CreateAccount, generateNewWalletFn: any, generateNewWallet?: boolean, testnet?: boolean, webhookUrl?: string) => Promise<any>;
|
117
|
+
};
|
118
|
+
};
|
119
|
+
security: {
|
120
|
+
checkMaliciousAddress: typeof import("@tatumio/api-client").SecurityAddressService.checkMalicousAddress;
|
121
|
+
};
|
122
|
+
tatum: {
|
123
|
+
getCredits: typeof import("@tatumio/api-client").TatumServiceService.getCredits;
|
124
|
+
getVersion: typeof import("@tatumio/api-client").TatumServiceService.getVersion;
|
125
|
+
freezeApiKey: typeof import("@tatumio/api-client").TatumServiceService.freezeApiKey;
|
126
|
+
unfreezeApiKey: typeof import("@tatumio/api-client").TatumServiceService.unfreezeApiKey;
|
127
|
+
};
|
128
|
+
nft: {
|
129
|
+
mintNFT: typeof import("@tatumio/api-client").BlockchainNftService.nftMintErc721;
|
130
|
+
getNFTTransaction: typeof import("@tatumio/api-client").BlockchainNftService.nftGetTransactErc721;
|
131
|
+
getNFTTransactionsByToken: typeof import("@tatumio/api-client").BlockchainNftService.nftGetTransactionByToken;
|
132
|
+
getNFTTransactionsByAddress: typeof import("@tatumio/api-client").BlockchainNftService.nftGetTransactionByAddress;
|
133
|
+
getNFTsByAddress: typeof import("@tatumio/api-client").BlockchainNftService.nftGetBalanceErc721;
|
134
|
+
getNFTProvenanceData: typeof import("@tatumio/api-client").BlockchainNftService.nftGetProvenanceDataErc721;
|
135
|
+
getNFTMetadataURI: typeof import("@tatumio/api-client").BlockchainNftService.nftGetMetadataErc721;
|
136
|
+
getNFTRoyalty: typeof import("@tatumio/api-client").BlockchainNftService.nftGetRoyaltyErc721;
|
137
|
+
prepareAddNFTMinterAbstraction: typeof import("@tatumio/api-client").BlockchainNftService.nftGetRoyaltyErc721;
|
138
|
+
};
|
139
|
+
};
|
@@ -0,0 +1,28 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.TatumBscSDK = void 0;
|
4
|
+
const tslib_1 = require("tslib");
|
5
|
+
const shared_blockchain_evm_based_1 = require("@tatumio/shared-blockchain-evm-based");
|
6
|
+
const shared_core_1 = require("@tatumio/shared-core");
|
7
|
+
const api_client_1 = require("@tatumio/api-client");
|
8
|
+
const bsc_web3_1 = require("./services/bsc.web3");
|
9
|
+
const bsc_kms_1 = require("./services/bsc.kms");
|
10
|
+
const bsc_tx_1 = require("./services/bsc.tx");
|
11
|
+
const blockchain = shared_core_1.Blockchain.BSC;
|
12
|
+
const TatumBscSDK = (args) => {
|
13
|
+
const web3 = (0, bsc_web3_1.bscWeb3)({ blockchain });
|
14
|
+
const api = api_client_1.BlockchainBscService;
|
15
|
+
return Object.assign(Object.assign({}, (0, shared_blockchain_evm_based_1.evmBasedSdk)(Object.assign(Object.assign({}, args), { blockchain, web3 }))), { api, kms: (0, bsc_kms_1.bscKmsService)({ blockchain, web3 }), transaction: (0, bsc_tx_1.bscTxService)({ blockchain, web3 }), httpDriver: (request) => (0, tslib_1.__awaiter)(void 0, void 0, void 0, function* () {
|
16
|
+
return api.bscWeb3Driver(args.apiKey, Object.assign(Object.assign({}, request), { jsonrpc: '2.0' }));
|
17
|
+
}), blockchain: {
|
18
|
+
broadcast: api_client_1.BlockchainBscService.bscBroadcast,
|
19
|
+
getTransactionsCount: api_client_1.BlockchainBscService.bscGetTransactionCount,
|
20
|
+
getCurrentBlock: api_client_1.BlockchainBscService.bscGetCurrentBlock,
|
21
|
+
getBlock: api_client_1.BlockchainBscService.bscGetBlock,
|
22
|
+
getBlockchainAccountBalance: api_client_1.BlockchainBscService.bscGetBalance,
|
23
|
+
get: api_client_1.BlockchainBscService.bscGetTransaction,
|
24
|
+
estimateGas: api_client_1.BlockchainBscService.bscEstimateGas,
|
25
|
+
} });
|
26
|
+
};
|
27
|
+
exports.TatumBscSDK = TatumBscSDK;
|
28
|
+
//# sourceMappingURL=bsc.sdk.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"bsc.sdk.js","sourceRoot":"","sources":["../../../../../../packages/blockchain/bsc/src/lib/bsc.sdk.ts"],"names":[],"mappings":";;;;AAAA,sFAAkE;AAClE,sDAA4E;AAC5E,oDAA0D;AAE1D,kDAA6C;AAC7C,gDAAkD;AAClD,8CAAgD;AAEhD,MAAM,UAAU,GAAG,wBAAU,CAAC,GAAG,CAAA;AAE1B,MAAM,WAAW,GAAG,CAAC,IAAkB,EAAE,EAAE;IAChD,MAAM,IAAI,GAAG,IAAA,kBAAO,EAAC,EAAE,UAAU,EAAE,CAAC,CAAA;IACpC,MAAM,GAAG,GAAG,iCAAoB,CAAA;IAEhC,uCACK,IAAA,yCAAW,kCAAM,IAAI,KAAE,UAAU,EAAE,IAAI,IAAG,KAC7C,GAAG,EACH,GAAG,EAAE,IAAA,uBAAa,EAAC,EAAE,UAAU,EAAE,IAAI,EAAE,CAAC,EACxC,WAAW,EAAE,IAAA,qBAAY,EAAC,EAAE,UAAU,EAAE,IAAI,EAAE,CAAC,EAC/C,UAAU,EAAE,CAAO,OAAoB,EAAyB,EAAE;YAChE,OAAO,GAAG,CAAC,aAAa,CAAC,IAAI,CAAC,MAAM,kCAAO,OAAO,KAAE,OAAO,EAAE,KAAK,IAAG,CAAA;QACvE,CAAC,CAAA,EACD,UAAU,EAAE;YACV,SAAS,EAAE,iCAAoB,CAAC,YAAY;YAC5C,oBAAoB,EAAE,iCAAoB,CAAC,sBAAsB;YACjE,eAAe,EAAE,iCAAoB,CAAC,kBAAkB;YACxD,QAAQ,EAAE,iCAAoB,CAAC,WAAW;YAC1C,2BAA2B,EAAE,iCAAoB,CAAC,aAAa;YAC/D,GAAG,EAAE,iCAAoB,CAAC,iBAAiB;YAC3C,WAAW,EAAE,iCAAoB,CAAC,cAAc;SACjD,IACF;AACH,CAAC,CAAA;AAtBY,QAAA,WAAW,eAsBvB"}
|
@@ -0,0 +1,10 @@
|
|
1
|
+
import { EvmBasedKMSServiceArgs } from '@tatumio/shared-blockchain-evm-based';
|
2
|
+
import { ChainTransactionKMS } from '@tatumio/shared-core';
|
3
|
+
import { PendingTransaction } from '@tatumio/api-client';
|
4
|
+
export declare const bscKmsService: (args: EvmBasedKMSServiceArgs) => {
|
5
|
+
sign(tx: ChainTransactionKMS, fromPrivateKey: string, provider?: string): Promise<string>;
|
6
|
+
getAllPending(signatures?: string): import("@tatumio/api-client").CancelablePromise<PendingTransaction>;
|
7
|
+
get: typeof import("@tatumio/api-client").SecurityKeyManagementSystemService.getPendingTransactionToSign;
|
8
|
+
complete: typeof import("@tatumio/api-client").SecurityKeyManagementSystemService.completePendingSignature;
|
9
|
+
delete: typeof import("@tatumio/api-client").SecurityKeyManagementSystemService.deletePendingTransactionToSign;
|
10
|
+
};
|
@@ -0,0 +1,34 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.bscKmsService = void 0;
|
4
|
+
const tslib_1 = require("tslib");
|
5
|
+
const shared_blockchain_abstract_1 = require("@tatumio/shared-blockchain-abstract");
|
6
|
+
const bscKmsService = (args) => {
|
7
|
+
return Object.assign(Object.assign({}, (0, shared_blockchain_abstract_1.abstractBlockchainKms)(args)), { sign(tx, fromPrivateKey, provider) {
|
8
|
+
return (0, tslib_1.__awaiter)(this, void 0, void 0, function* () {
|
9
|
+
// @TODO: probably bug in OpenAPI
|
10
|
+
;
|
11
|
+
tx.chain = 'BSC';
|
12
|
+
const client = args.web3.getClient(provider);
|
13
|
+
const transactionConfig = JSON.parse(tx.serializedTransaction);
|
14
|
+
if (!transactionConfig.gas) {
|
15
|
+
transactionConfig.gas = yield client.eth.estimateGas({
|
16
|
+
to: transactionConfig.to,
|
17
|
+
data: transactionConfig.data,
|
18
|
+
});
|
19
|
+
}
|
20
|
+
if (!transactionConfig.gasPrice ||
|
21
|
+
transactionConfig.gasPrice === '0' ||
|
22
|
+
transactionConfig.gasPrice === 0 ||
|
23
|
+
transactionConfig.gasPrice === '0x0') {
|
24
|
+
transactionConfig.gasPrice = yield args.web3.getGasPriceInWei();
|
25
|
+
}
|
26
|
+
const signedTransaction = yield client.eth.accounts.signTransaction(transactionConfig, fromPrivateKey);
|
27
|
+
// @TODO: resolve undefined result
|
28
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
29
|
+
return signedTransaction.rawTransaction;
|
30
|
+
});
|
31
|
+
} });
|
32
|
+
};
|
33
|
+
exports.bscKmsService = bscKmsService;
|
34
|
+
//# sourceMappingURL=bsc.kms.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"bsc.kms.js","sourceRoot":"","sources":["../../../../../../../packages/blockchain/bsc/src/lib/services/bsc.kms.ts"],"names":[],"mappings":";;;;AAGA,oFAA2E;AAEpE,MAAM,aAAa,GAAG,CAAC,IAA4B,EAAE,EAAE;IAC5D,uCACK,IAAA,kDAAqB,EAAC,IAAI,CAAC,KACxB,IAAI,CAAC,EAAuB,EAAE,cAAsB,EAAE,QAAiB;;gBAC3E,iCAAiC;gBACjC,CAAC;gBAAC,EAAyB,CAAC,KAAK,GAAG,KAAY,CAAA;gBAChD,MAAM,MAAM,GAAG,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAA;gBAC5C,MAAM,iBAAiB,GAAG,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,qBAAqB,CAAC,CAAA;gBAE9D,IAAI,CAAC,iBAAiB,CAAC,GAAG,EAAE;oBAC1B,iBAAiB,CAAC,GAAG,GAAG,MAAM,MAAM,CAAC,GAAG,CAAC,WAAW,CAAC;wBACnD,EAAE,EAAE,iBAAiB,CAAC,EAAE;wBACxB,IAAI,EAAE,iBAAiB,CAAC,IAAI;qBAC7B,CAAC,CAAA;iBACH;gBAED,IACE,CAAC,iBAAiB,CAAC,QAAQ;oBAC3B,iBAAiB,CAAC,QAAQ,KAAK,GAAG;oBAClC,iBAAiB,CAAC,QAAQ,KAAK,CAAC;oBAChC,iBAAiB,CAAC,QAAQ,KAAK,KAAK,EACpC;oBACA,iBAAiB,CAAC,QAAQ,GAAG,MAAM,IAAI,CAAC,IAAI,CAAC,gBAAgB,EAAE,CAAA;iBAChE;gBAED,MAAM,iBAAiB,GAAG,MAAM,MAAM,CAAC,GAAG,CAAC,QAAQ,CAAC,eAAe,CAAC,iBAAiB,EAAE,cAAc,CAAC,CAAA;gBAEtG,kCAAkC;gBAClC,oEAAoE;gBACpE,OAAO,iBAAiB,CAAC,cAAe,CAAA;YAC1C,CAAC;SAAA,IACF;AACH,CAAC,CAAA;AAhCY,QAAA,aAAa,iBAgCzB"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"bsc.tx.js","sourceRoot":"","sources":["../../../../../../../packages/blockchain/bsc/src/lib/services/bsc.tx.ts"],"names":[],"mappings":";;;AAGO,MAAM,YAAY,GAAG,CAAC,IAA4D,EAAE,EAAE;IAC3F,OAAO,EAAE,CAAA;AACX,CAAC,CAAA;AAFY,QAAA,YAAY,gBAExB"}
|
@@ -0,0 +1,8 @@
|
|
1
|
+
import Web3 from 'web3';
|
2
|
+
import { EvmBasedBlockchain } from '@tatumio/shared-core';
|
3
|
+
export declare const bscWeb3: (args: {
|
4
|
+
blockchain: EvmBasedBlockchain;
|
5
|
+
}) => {
|
6
|
+
getClient(provider?: string, fromPrivateKey?: string): Web3;
|
7
|
+
getGasPriceInWei(): Promise<string>;
|
8
|
+
};
|
@@ -0,0 +1,24 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.bscWeb3 = void 0;
|
4
|
+
const tslib_1 = require("tslib");
|
5
|
+
const shared_blockchain_evm_based_1 = require("@tatumio/shared-blockchain-evm-based");
|
6
|
+
const web3_1 = (0, tslib_1.__importDefault)(require("web3"));
|
7
|
+
const bscWeb3 = (args) => {
|
8
|
+
const evmBasedWeb3Result = (0, shared_blockchain_evm_based_1.evmBasedWeb3)(args);
|
9
|
+
return Object.assign(Object.assign({}, evmBasedWeb3Result), { getClient(provider, fromPrivateKey) {
|
10
|
+
const web3 = evmBasedWeb3Result.getClient(provider);
|
11
|
+
if (fromPrivateKey) {
|
12
|
+
web3.eth.accounts.wallet.add(fromPrivateKey);
|
13
|
+
web3.eth.defaultAccount = web3.eth.accounts.wallet[0].address;
|
14
|
+
}
|
15
|
+
return web3;
|
16
|
+
},
|
17
|
+
getGasPriceInWei() {
|
18
|
+
return (0, tslib_1.__awaiter)(this, void 0, void 0, function* () {
|
19
|
+
return web3_1.default.utils.toWei('10', 'gwei');
|
20
|
+
});
|
21
|
+
} });
|
22
|
+
};
|
23
|
+
exports.bscWeb3 = bscWeb3;
|
24
|
+
//# sourceMappingURL=bsc.web3.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"bsc.web3.js","sourceRoot":"","sources":["../../../../../../../packages/blockchain/bsc/src/lib/services/bsc.web3.ts"],"names":[],"mappings":";;;;AAAA,sFAAmE;AACnE,6DAAuB;AAGhB,MAAM,OAAO,GAAG,CAAC,IAAwC,EAAE,EAAE;IAClE,MAAM,kBAAkB,GAAG,IAAA,0CAAY,EAAC,IAAI,CAAC,CAAA;IAE7C,uCACK,kBAAkB,KACrB,SAAS,CAAC,QAAiB,EAAE,cAAuB;YAClD,MAAM,IAAI,GAAG,kBAAkB,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAA;YAEnD,IAAI,cAAc,EAAE;gBAClB,IAAI,CAAC,GAAG,CAAC,QAAQ,CAAC,MAAM,CAAC,GAAG,CAAC,cAAc,CAAC,CAAA;gBAC5C,IAAI,CAAC,GAAG,CAAC,cAAc,GAAG,IAAI,CAAC,GAAG,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,OAAO,CAAA;aAC9D;YAED,OAAO,IAAI,CAAA;QACb,CAAC;QACK,gBAAgB;;gBACpB,OAAO,cAAI,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,EAAE,MAAM,CAAC,CAAA;YACvC,CAAC;SAAA,IACF;AACH,CAAC,CAAA;AAnBY,QAAA,OAAO,WAmBnB"}
|