@tatumio/celo 2.0.1-alpha.203
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/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/celo.sdk.d.ts +138 -0
- package/src/lib/celo.sdk.js +28 -0
- package/src/lib/celo.sdk.js.map +1 -0
- package/src/lib/services/celo.kms.d.ts +12 -0
- package/src/lib/services/celo.kms.js +9 -0
- package/src/lib/services/celo.kms.js.map +1 -0
- package/src/lib/services/celo.tx.d.ts +6 -0
- package/src/lib/services/celo.tx.js +8 -0
- package/src/lib/services/celo.tx.js.map +1 -0
- package/src/lib/services/celo.web3.d.ts +8 -0
- package/src/lib/services/celo.web3.js +33 -0
- package/src/lib/services/celo.web3.js.map +1 -0
package/package.json
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@tatumio/celo",
|
|
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/celo.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/celo/src/index.ts"],"names":[],"mappings":";;;AAAA,8DAA8B"}
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
import { Web3Request, Web3Response } from '@tatumio/shared-core';
|
|
2
|
+
import { SDKArguments } from '@tatumio/shared-abstract-sdk';
|
|
3
|
+
import { BlockchainCeloService } from '@tatumio/api-client';
|
|
4
|
+
export declare const TatumCeloSDK: (args: SDKArguments) => {
|
|
5
|
+
api: typeof BlockchainCeloService;
|
|
6
|
+
kms: {
|
|
7
|
+
getAllPending(signatures?: string): import("@tatumio/api-client").CancelablePromise<import("@tatumio/api-client").PendingTransaction>;
|
|
8
|
+
get: typeof import("@tatumio/api-client").SecurityKeyManagementSystemService.getPendingTransactionToSign;
|
|
9
|
+
complete: typeof import("@tatumio/api-client").SecurityKeyManagementSystemService.completePendingSignature;
|
|
10
|
+
delete: typeof import("@tatumio/api-client").SecurityKeyManagementSystemService.deletePendingTransactionToSign;
|
|
11
|
+
};
|
|
12
|
+
transaction: {};
|
|
13
|
+
httpDriver: (request: Web3Request) => Promise<Web3Response>;
|
|
14
|
+
blockchain: {
|
|
15
|
+
broadcast: typeof BlockchainCeloService.celoBroadcast;
|
|
16
|
+
getTransactionsCount: typeof BlockchainCeloService.celoGetTransactionCount;
|
|
17
|
+
getCurrentBlock: typeof BlockchainCeloService.celoGetCurrentBlock;
|
|
18
|
+
getBlock: typeof BlockchainCeloService.celoGetBlock;
|
|
19
|
+
getBlockchainAccountBalance: typeof BlockchainCeloService.celoGetBalance;
|
|
20
|
+
get: typeof BlockchainCeloService.celoGetTransaction;
|
|
21
|
+
getAccountTransactions: typeof BlockchainCeloService.celoGetTransactionByAddress;
|
|
22
|
+
};
|
|
23
|
+
web3Client: (provider?: string) => import("web3").default;
|
|
24
|
+
record: {
|
|
25
|
+
getLog(id: string): import("@tatumio/api-client").CancelablePromise<{
|
|
26
|
+
data: string;
|
|
27
|
+
}>;
|
|
28
|
+
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>;
|
|
29
|
+
};
|
|
30
|
+
getGasPriceInWei: () => Promise<string>;
|
|
31
|
+
wallet: {
|
|
32
|
+
generateAddressFromXPub(xpub: string, i: number): string;
|
|
33
|
+
generatePrivateKeyFromMnemonic(mnemonic: string, i: number, options?: {
|
|
34
|
+
testnet: boolean;
|
|
35
|
+
}): Promise<string>;
|
|
36
|
+
generateAddressFromPrivateKey(privateKey: string): string;
|
|
37
|
+
generateWallet(mnemonic?: string, options?: {
|
|
38
|
+
testnet: boolean;
|
|
39
|
+
}): Promise<import("@tatumio/api-client").TronWallet>;
|
|
40
|
+
};
|
|
41
|
+
offchain: {
|
|
42
|
+
depositAddress: {
|
|
43
|
+
checkExists: (address: string, index?: number) => Promise<import("@tatumio/api-client").Account>;
|
|
44
|
+
create: typeof import("@tatumio/api-client").OffChainAccountService.generateDepositAddress;
|
|
45
|
+
createMultiple: typeof import("@tatumio/api-client").OffChainAccountService.generateDepositAddressesBatch;
|
|
46
|
+
assign: typeof import("@tatumio/api-client").OffChainAccountService.assignAddress;
|
|
47
|
+
remove: typeof import("@tatumio/api-client").OffChainAccountService.removeAddress;
|
|
48
|
+
getByAccount: typeof import("@tatumio/api-client").OffChainAccountService.getAllDepositAddresses;
|
|
49
|
+
};
|
|
50
|
+
withdrawal: {
|
|
51
|
+
getAll: (status?: "InProgress" | "Done" | "Cancelled", pageSize?: number, offset?: number) => Promise<import("@tatumio/api-client").WithdrawalObject[]>;
|
|
52
|
+
};
|
|
53
|
+
storeTokenAddress: typeof import("@tatumio/api-client").OffChainBlockchainService.storeTokenAddress;
|
|
54
|
+
};
|
|
55
|
+
getExchangeRate(basePair?: import("@tatumio/shared-core").Fiat): import("@tatumio/api-client").CancelablePromise<import("@tatumio/api-client").ExchangeRate>;
|
|
56
|
+
storage: {
|
|
57
|
+
upload: typeof import("@tatumio/api-client").StorageIpfsService.storeIpfs;
|
|
58
|
+
get: typeof import("@tatumio/api-client").StorageIpfsService.getIpfsData;
|
|
59
|
+
};
|
|
60
|
+
subscriptions: typeof import("@tatumio/api-client").LedgerSubscriptionService;
|
|
61
|
+
ledger: {
|
|
62
|
+
customer: {
|
|
63
|
+
get: typeof import("@tatumio/api-client").LedgerCustomerService.getCustomerByExternalOrInternalId;
|
|
64
|
+
getAll: typeof import("@tatumio/api-client").LedgerCustomerService.findAllCustomers;
|
|
65
|
+
update: typeof import("@tatumio/api-client").LedgerCustomerService.updateCustomer;
|
|
66
|
+
activate: typeof import("@tatumio/api-client").LedgerCustomerService.activateCustomer;
|
|
67
|
+
deactivate: typeof import("@tatumio/api-client").LedgerCustomerService.deactivateCustomer;
|
|
68
|
+
enable: typeof import("@tatumio/api-client").LedgerCustomerService.enableCustomer;
|
|
69
|
+
disable: typeof import("@tatumio/api-client").LedgerCustomerService.disableCustomer;
|
|
70
|
+
};
|
|
71
|
+
orderBook: {
|
|
72
|
+
getHistorical: typeof import("@tatumio/api-client").LedgerOrderBookService.getHistoricalTradesBody;
|
|
73
|
+
getActiveBuyTrades: typeof import("@tatumio/api-client").LedgerOrderBookService.getBuyTradesBody;
|
|
74
|
+
getActiveSellTrades: typeof import("@tatumio/api-client").LedgerOrderBookService.getBuyTradesBody;
|
|
75
|
+
newTrade: typeof import("@tatumio/api-client").LedgerOrderBookService.storeTrade;
|
|
76
|
+
get: typeof import("@tatumio/api-client").LedgerOrderBookService.getTradeById;
|
|
77
|
+
cancel: typeof import("@tatumio/api-client").LedgerOrderBookService.deleteTrade;
|
|
78
|
+
cancelByAccount: typeof import("@tatumio/api-client").LedgerOrderBookService.deleteAccountTrades;
|
|
79
|
+
};
|
|
80
|
+
transaction: {
|
|
81
|
+
send: typeof import("@tatumio/api-client").LedgerTransactionService.sendTransaction;
|
|
82
|
+
sendMultiple: typeof import("@tatumio/api-client").LedgerTransactionService.sendTransactionBatch;
|
|
83
|
+
getAll: typeof import("@tatumio/api-client").LedgerTransactionService.getTransactions;
|
|
84
|
+
getAllByAccount: typeof import("@tatumio/api-client").LedgerTransactionService.getTransactionsByAccountId;
|
|
85
|
+
getAllByCustomer: typeof import("@tatumio/api-client").LedgerTransactionService.getTransactionsByCustomerId;
|
|
86
|
+
getAllByReference: typeof import("@tatumio/api-client").LedgerTransactionService.getTransactionsByReference;
|
|
87
|
+
countByAccount: (filter: import("@tatumio/api-client").TransactionFilter) => any;
|
|
88
|
+
countByCustomer: (filter: import("@tatumio/api-client").TransactionFilterCustomer) => any;
|
|
89
|
+
};
|
|
90
|
+
virtualCurrency: {
|
|
91
|
+
create: typeof import("@tatumio/api-client").LedgerVirtualCurrencyService.createCurrency;
|
|
92
|
+
mint: typeof import("@tatumio/api-client").LedgerVirtualCurrencyService.mintCurrency;
|
|
93
|
+
revoke: typeof import("@tatumio/api-client").LedgerVirtualCurrencyService.revokeCurrency;
|
|
94
|
+
getByName: typeof import("@tatumio/api-client").LedgerVirtualCurrencyService.getCurrency;
|
|
95
|
+
update: typeof import("@tatumio/api-client").LedgerVirtualCurrencyService.updateCurrency;
|
|
96
|
+
};
|
|
97
|
+
blockAmount: {
|
|
98
|
+
block: typeof import("@tatumio/api-client").LedgerAccountService.blockAmount;
|
|
99
|
+
unblock: typeof import("@tatumio/api-client").LedgerAccountService.deleteBlockAmount;
|
|
100
|
+
unblockWithTransaction: typeof import("@tatumio/api-client").LedgerAccountService.unblockAmountWithTransaction;
|
|
101
|
+
};
|
|
102
|
+
account: {
|
|
103
|
+
get: typeof import("@tatumio/api-client").LedgerAccountService.getAccountByAccountId;
|
|
104
|
+
getAll: typeof import("@tatumio/api-client").LedgerAccountService.getAllAccounts;
|
|
105
|
+
getByCustomerId: typeof import("@tatumio/api-client").LedgerAccountService.getAccountsByCustomerId;
|
|
106
|
+
getBalance: typeof import("@tatumio/api-client").LedgerAccountService.getAccountBalance;
|
|
107
|
+
create: typeof import("@tatumio/api-client").LedgerAccountService.createAccount;
|
|
108
|
+
createMultiple: typeof import("@tatumio/api-client").LedgerAccountService.createAccountBatch;
|
|
109
|
+
update: typeof import("@tatumio/api-client").LedgerAccountService.updateAccountByAccountId;
|
|
110
|
+
getBlockedAmountsByAccountId: typeof import("@tatumio/api-client").LedgerAccountService.getBlockAmountById;
|
|
111
|
+
activate: typeof import("@tatumio/api-client").LedgerAccountService.activateAccount;
|
|
112
|
+
deactivate: typeof import("@tatumio/api-client").LedgerAccountService.deactivateAccount;
|
|
113
|
+
freeze: typeof import("@tatumio/api-client").LedgerAccountService.freezeAccount;
|
|
114
|
+
unfreeze: typeof import("@tatumio/api-client").LedgerAccountService.unfreezeAccount;
|
|
115
|
+
generate: (account: import("@tatumio/api-client").CreateAccount, generateNewWalletFn: any, generateNewWallet?: boolean, testnet?: boolean, webhookUrl?: string) => Promise<any>;
|
|
116
|
+
};
|
|
117
|
+
};
|
|
118
|
+
security: {
|
|
119
|
+
checkMaliciousAddress: typeof import("@tatumio/api-client").SecurityAddressService.checkMalicousAddress;
|
|
120
|
+
};
|
|
121
|
+
tatum: {
|
|
122
|
+
getCredits: typeof import("@tatumio/api-client").TatumServiceService.getCredits;
|
|
123
|
+
getVersion: typeof import("@tatumio/api-client").TatumServiceService.getVersion;
|
|
124
|
+
freezeApiKey: typeof import("@tatumio/api-client").TatumServiceService.freezeApiKey;
|
|
125
|
+
unfreezeApiKey: typeof import("@tatumio/api-client").TatumServiceService.unfreezeApiKey;
|
|
126
|
+
};
|
|
127
|
+
nft: {
|
|
128
|
+
mintNFT: typeof import("@tatumio/api-client").BlockchainNftService.nftMintErc721;
|
|
129
|
+
getNFTTransaction: typeof import("@tatumio/api-client").BlockchainNftService.nftGetTransactErc721;
|
|
130
|
+
getNFTTransactionsByToken: typeof import("@tatumio/api-client").BlockchainNftService.nftGetTransactionByToken;
|
|
131
|
+
getNFTTransactionsByAddress: typeof import("@tatumio/api-client").BlockchainNftService.nftGetTransactionByAddress;
|
|
132
|
+
getNFTsByAddress: typeof import("@tatumio/api-client").BlockchainNftService.nftGetBalanceErc721;
|
|
133
|
+
getNFTProvenanceData: typeof import("@tatumio/api-client").BlockchainNftService.nftGetProvenanceDataErc721;
|
|
134
|
+
getNFTMetadataURI: typeof import("@tatumio/api-client").BlockchainNftService.nftGetMetadataErc721;
|
|
135
|
+
getNFTRoyalty: typeof import("@tatumio/api-client").BlockchainNftService.nftGetRoyaltyErc721;
|
|
136
|
+
prepareAddNFTMinterAbstraction: typeof import("@tatumio/api-client").BlockchainNftService.nftGetRoyaltyErc721;
|
|
137
|
+
};
|
|
138
|
+
};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.TatumCeloSDK = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const shared_core_1 = require("@tatumio/shared-core");
|
|
6
|
+
const api_client_1 = require("@tatumio/api-client");
|
|
7
|
+
const celo_web3_1 = require("./services/celo.web3");
|
|
8
|
+
const shared_blockchain_evm_based_1 = require("@tatumio/shared-blockchain-evm-based");
|
|
9
|
+
const celo_kms_1 = require("./services/celo.kms");
|
|
10
|
+
const celo_tx_1 = require("./services/celo.tx");
|
|
11
|
+
const blockchain = shared_core_1.Blockchain.CELO;
|
|
12
|
+
const TatumCeloSDK = (args) => {
|
|
13
|
+
const web3 = (0, celo_web3_1.celoWeb3)({ blockchain });
|
|
14
|
+
const api = api_client_1.BlockchainCeloService;
|
|
15
|
+
return Object.assign(Object.assign({}, (0, shared_blockchain_evm_based_1.evmBasedSdk)(Object.assign(Object.assign({}, args), { blockchain, web3 }))), { api, kms: (0, celo_kms_1.celoKmsService)({ blockchain, web3 }), transaction: (0, celo_tx_1.celoTxService)({ blockchain, web3 }), httpDriver: (request) => (0, tslib_1.__awaiter)(void 0, void 0, void 0, function* () {
|
|
16
|
+
return api.celoWeb3Driver(args.apiKey, Object.assign(Object.assign({}, request), { jsonrpc: '2.0' }));
|
|
17
|
+
}), blockchain: {
|
|
18
|
+
broadcast: api_client_1.BlockchainCeloService.celoBroadcast,
|
|
19
|
+
getTransactionsCount: api_client_1.BlockchainCeloService.celoGetTransactionCount,
|
|
20
|
+
getCurrentBlock: api_client_1.BlockchainCeloService.celoGetCurrentBlock,
|
|
21
|
+
getBlock: api_client_1.BlockchainCeloService.celoGetBlock,
|
|
22
|
+
getBlockchainAccountBalance: api_client_1.BlockchainCeloService.celoGetBalance,
|
|
23
|
+
get: api_client_1.BlockchainCeloService.celoGetTransaction,
|
|
24
|
+
getAccountTransactions: api_client_1.BlockchainCeloService.celoGetTransactionByAddress,
|
|
25
|
+
} });
|
|
26
|
+
};
|
|
27
|
+
exports.TatumCeloSDK = TatumCeloSDK;
|
|
28
|
+
//# sourceMappingURL=celo.sdk.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"celo.sdk.js","sourceRoot":"","sources":["../../../../../../packages/blockchain/celo/src/lib/celo.sdk.ts"],"names":[],"mappings":";;;;AAAA,sDAA4E;AAE5E,oDAA2D;AAC3D,oDAA+C;AAC/C,sFAAkE;AAClE,kDAAoD;AACpD,gDAAkD;AAElD,MAAM,UAAU,GAAG,wBAAU,CAAC,IAAI,CAAA;AAE3B,MAAM,YAAY,GAAG,CAAC,IAAkB,EAAE,EAAE;IACjD,MAAM,IAAI,GAAG,IAAA,oBAAQ,EAAC,EAAE,UAAU,EAAE,CAAC,CAAA;IACrC,MAAM,GAAG,GAAG,kCAAqB,CAAA;IAEjC,uCACK,IAAA,yCAAW,kCAAM,IAAI,KAAE,UAAU,EAAE,IAAI,IAAG,KAC7C,GAAG,EACH,GAAG,EAAE,IAAA,yBAAc,EAAC,EAAE,UAAU,EAAE,IAAI,EAAE,CAAC,EACzC,WAAW,EAAE,IAAA,uBAAa,EAAC,EAAE,UAAU,EAAE,IAAI,EAAE,CAAC,EAChD,UAAU,EAAE,CAAO,OAAoB,EAAyB,EAAE;YAChE,OAAO,GAAG,CAAC,cAAc,CAAC,IAAI,CAAC,MAAM,kCAAO,OAAO,KAAE,OAAO,EAAE,KAAK,IAAG,CAAA;QACxE,CAAC,CAAA,EACD,UAAU,EAAE;YACV,SAAS,EAAE,kCAAqB,CAAC,aAAa;YAC9C,oBAAoB,EAAE,kCAAqB,CAAC,uBAAuB;YACnE,eAAe,EAAE,kCAAqB,CAAC,mBAAmB;YAC1D,QAAQ,EAAE,kCAAqB,CAAC,YAAY;YAC5C,2BAA2B,EAAE,kCAAqB,CAAC,cAAc;YACjE,GAAG,EAAE,kCAAqB,CAAC,kBAAkB;YAC7C,sBAAsB,EAAE,kCAAqB,CAAC,2BAA2B;SAC1E,IACF;AACH,CAAC,CAAA;AAtBY,QAAA,YAAY,gBAsBxB"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { EvmBasedWeb3 } from '@tatumio/shared-blockchain-evm-based';
|
|
2
|
+
import { EvmBasedBlockchain } from '@tatumio/shared-core';
|
|
3
|
+
import { PendingTransaction } from '@tatumio/api-client';
|
|
4
|
+
export declare const celoKmsService: (args: {
|
|
5
|
+
blockchain: EvmBasedBlockchain;
|
|
6
|
+
web3: EvmBasedWeb3;
|
|
7
|
+
}) => {
|
|
8
|
+
getAllPending(signatures?: string): import("@tatumio/api-client").CancelablePromise<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
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.celoKmsService = void 0;
|
|
4
|
+
const shared_blockchain_abstract_1 = require("@tatumio/shared-blockchain-abstract");
|
|
5
|
+
const celoKmsService = (args) => {
|
|
6
|
+
return Object.assign({}, (0, shared_blockchain_abstract_1.abstractBlockchainKms)(args));
|
|
7
|
+
};
|
|
8
|
+
exports.celoKmsService = celoKmsService;
|
|
9
|
+
//# sourceMappingURL=celo.kms.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"celo.kms.js","sourceRoot":"","sources":["../../../../../../../packages/blockchain/celo/src/lib/services/celo.kms.ts"],"names":[],"mappings":";;;AAGA,oFAA2E;AAEpE,MAAM,cAAc,GAAG,CAAC,IAA4D,EAAE,EAAE;IAC7F,yBACK,IAAA,kDAAqB,EAAC,IAAI,CAAC,EAyC/B;AACH,CAAC,CAAA;AA5CY,QAAA,cAAc,kBA4C1B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"celo.tx.js","sourceRoot":"","sources":["../../../../../../../packages/blockchain/celo/src/lib/services/celo.tx.ts"],"names":[],"mappings":";;;AAGO,MAAM,aAAa,GAAG,CAAC,IAA4D,EAAE,EAAE;IAC5F,OAAO,EAAE,CAAA;AACX,CAAC,CAAA;AAFY,QAAA,aAAa,iBAEzB"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import Web3 from 'web3';
|
|
2
|
+
import { EvmBasedBlockchain } from '@tatumio/shared-core';
|
|
3
|
+
export declare const celoWeb3: (args: {
|
|
4
|
+
blockchain: EvmBasedBlockchain;
|
|
5
|
+
}) => {
|
|
6
|
+
getClient(provider?: string, fromPrivateKey?: string): Web3;
|
|
7
|
+
getGasPriceInWei(): Promise<string>;
|
|
8
|
+
};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.celoWeb3 = 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 shared_core_1 = require("@tatumio/shared-core");
|
|
8
|
+
const celoWeb3 = (args) => {
|
|
9
|
+
const evmBasedWeb3Result = (0, shared_blockchain_evm_based_1.evmBasedWeb3)(args);
|
|
10
|
+
return Object.assign(Object.assign({}, evmBasedWeb3Result), { getClient(provider, fromPrivateKey) {
|
|
11
|
+
const web3 = evmBasedWeb3Result.getClient(provider);
|
|
12
|
+
if (fromPrivateKey) {
|
|
13
|
+
web3.eth.accounts.wallet.add(fromPrivateKey);
|
|
14
|
+
web3.eth.defaultAccount = web3.eth.accounts.wallet[0].address;
|
|
15
|
+
}
|
|
16
|
+
return web3;
|
|
17
|
+
},
|
|
18
|
+
getGasPriceInWei() {
|
|
19
|
+
var _a;
|
|
20
|
+
return (0, tslib_1.__awaiter)(this, void 0, void 0, function* () {
|
|
21
|
+
let gasStationUrl = shared_core_1.THIRD_PARTY_API.ETH_GAS_STATION;
|
|
22
|
+
const gasStationApiKey = process.env['TATUM_GAS_STATION_API_KEY']; // @TODO
|
|
23
|
+
if (gasStationApiKey) {
|
|
24
|
+
gasStationUrl = `${gasStationUrl}?apiKey=${gasStationApiKey}`;
|
|
25
|
+
}
|
|
26
|
+
const data = (yield shared_core_1.httpHelper.get(gasStationUrl)).data;
|
|
27
|
+
const gasPrice = (_a = data['fast']) !== null && _a !== void 0 ? _a : 20;
|
|
28
|
+
return web3_1.default.utils.toWei((gasPrice / 10).toString(), 'gwei');
|
|
29
|
+
});
|
|
30
|
+
} });
|
|
31
|
+
};
|
|
32
|
+
exports.celoWeb3 = celoWeb3;
|
|
33
|
+
//# sourceMappingURL=celo.web3.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"celo.web3.js","sourceRoot":"","sources":["../../../../../../../packages/blockchain/celo/src/lib/services/celo.web3.ts"],"names":[],"mappings":";;;;AAAA,sFAAmE;AACnE,6DAAuB;AACvB,sDAAsF;AAE/E,MAAM,QAAQ,GAAG,CAAC,IAAwC,EAAE,EAAE;IACnE,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,IAAI,aAAa,GAAG,6BAAe,CAAC,eAAe,CAAA;gBACnD,MAAM,gBAAgB,GAAG,OAAO,CAAC,GAAG,CAAC,2BAA2B,CAAC,CAAA,CAAC,QAAQ;gBAC1E,IAAI,gBAAgB,EAAE;oBACpB,aAAa,GAAG,GAAG,aAAa,WAAW,gBAAgB,EAAE,CAAA;iBAC9D;gBAED,MAAM,IAAI,GAAG,CAAC,MAAM,wBAAU,CAAC,GAAG,CAAC,aAAa,CAAC,CAAC,CAAC,IAAI,CAAA;gBACvD,MAAM,QAAQ,GAAG,MAAA,IAAI,CAAC,MAAM,CAAC,mCAAI,EAAE,CAAA;gBAEnC,OAAO,cAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,QAAQ,GAAG,EAAE,CAAC,CAAC,QAAQ,EAAE,EAAE,MAAM,CAAC,CAAA;;SAC5D,IACF;AACH,CAAC,CAAA;AA5BY,QAAA,QAAQ,YA4BpB"}
|