@tatumio/algo 2.0.1-alpha.232

Sign up to get free protection for your applications and to get access to all the features.
package/package.json ADDED
@@ -0,0 +1,22 @@
1
+ {
2
+ "name": "@tatumio/algo",
3
+ "version": "2.0.1-alpha.232",
4
+ "type": "commonjs",
5
+ "license": "MIT",
6
+ "main": "./src/index.js",
7
+ "typings": "./src/index.d.ts",
8
+ "dependencies": {
9
+ "@tatumio/shared-testing-common": "2.0.1-alpha.232",
10
+ "@tatumio/shared-blockchain-abstract": "2.0.1-alpha.232",
11
+ "@tatumio/api-client": "2.0.1-alpha.232",
12
+ "axios": "^0.24.0",
13
+ "form-data": "^4.0.0",
14
+ "@tatumio/shared-core": "2.0.1-alpha.232",
15
+ "@tatumio/shared-abstract-sdk": "2.0.1-alpha.232",
16
+ "bignumber.js": "^9.0.2",
17
+ "algosdk": "^1.13.1",
18
+ "base32.js": "^0.1.0",
19
+ "url-parse": "^1.5.4"
20
+ },
21
+ "peerDependencies": {}
22
+ }
package/src/index.d.ts ADDED
@@ -0,0 +1 @@
1
+ export * from './lib/algo.sdk';
package/src/index.js ADDED
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const tslib_1 = require("tslib");
4
+ (0, tslib_1.__exportStar)(require("./lib/algo.sdk"), exports);
5
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../packages/blockchain/algo/src/index.ts"],"names":[],"mappings":";;;AAAA,8DAA8B"}
@@ -0,0 +1,176 @@
1
+ import { SDKArguments } from '@tatumio/shared-abstract-sdk';
2
+ import { BlockchainAlgorandAlgoService } from '@tatumio/api-client';
3
+ export declare const TatumAlgoSDK: (args: SDKArguments) => {
4
+ algoWeb: import("./services/algo.web").AlgoWeb;
5
+ record: {
6
+ getLog(id: string): import("@tatumio/api-client").CancelablePromise<{
7
+ data: string;
8
+ }>;
9
+ };
10
+ wallet: {
11
+ generateWallet(mnemonic?: string): import("@tatumio/api-client").AlgoWallet;
12
+ generateAddressFromPrivatetKey(privateKey: string): string;
13
+ };
14
+ transaction: {
15
+ prepare: {
16
+ signedTransaction: (body: import("./services/algo.tx").TransferAlgo | import("./services/algo.tx").TransferAlgoKMS, testnet?: boolean, provider?: string) => Promise<string>;
17
+ };
18
+ send: {
19
+ signedTransaction: (body: import("./services/algo.tx").TransferAlgo | import("./services/algo.tx").TransferAlgoKMS, testnet?: boolean, provider?: string) => Promise<import("@tatumio/api-client").TransactionHashKMS>;
20
+ };
21
+ };
22
+ erc20: {
23
+ prepare: {
24
+ createFTSignedTransaction: (body: import("./services/algo.tx").DeployErc20KMS | import("./services/algo.tx").DeployErc20, testnet?: boolean, provider?: string) => Promise<string>;
25
+ transferFTSignedTransaction: (body: import("./services/algo.tx").ChainTransferAlgoErc20 | import("./services/algo.tx").ChainTransferAlgoErc20KMS, testnet?: boolean, provider?: string) => Promise<string>;
26
+ burnFTSignedTransaction: (body: import("./services/algo.tx").ChainTransferAlgoErc20 | import("./services/algo.tx").ChainTransferAlgoErc20KMS, testnet?: boolean, provider?: string) => Promise<string>;
27
+ };
28
+ send: {
29
+ createFTSignedTransaction: (body: import("./services/algo.tx").DeployErc20KMS | import("./services/algo.tx").DeployErc20, testnet?: boolean, provider?: string) => Promise<import("@tatumio/api-client").TransactionHashKMS>;
30
+ transferFTSignedTransaction: (body: import("./services/algo.tx").ChainTransferAlgoErc20 | import("./services/algo.tx").ChainTransferAlgoErc20KMS, testnet?: boolean, provider?: string) => Promise<import("@tatumio/api-client").TransactionHashKMS>;
31
+ burnFTSignedTransaction: (body: import("./services/algo.tx").ChainTransferAlgoErc20 | import("./services/algo.tx").ChainTransferAlgoErc20KMS, testnet?: boolean, provider?: string) => Promise<import("@tatumio/api-client").TransactionHashKMS>;
32
+ };
33
+ };
34
+ erc721: {
35
+ prepare: {
36
+ createNFTSignedTransaction: (body: import("./services/algo.tx").DeployNftKMS | import("./services/algo.tx").DeployNft, testnet?: boolean, provider?: string) => Promise<string>;
37
+ transferNFTSignedTransaction: (body: import("./services/algo.tx").TransferNftKMS | import("./services/algo.tx").TransferNft, testnet?: boolean, provider?: string) => Promise<string>;
38
+ burnNFTSignedTransaction: (body: import("./services/algo.tx").BurnNftKMS | import("./services/algo.tx").BurnNft, testnet?: boolean, provider?: string) => Promise<string>;
39
+ };
40
+ send: {
41
+ createNFTSignedTransaction: (body: import("./services/algo.tx").DeployNftKMS | import("./services/algo.tx").DeployNft, testnet?: boolean, provider?: string) => Promise<import("@tatumio/api-client").TransactionHashKMS>;
42
+ transferNFTSignedTransaction: (body: import("./services/algo.tx").TransferNftKMS | import("./services/algo.tx").TransferNft, testnet?: boolean, provider?: string) => Promise<import("@tatumio/api-client").TransactionHashKMS>;
43
+ burnNFTSignedTransaction: (body: import("./services/algo.tx").BurnNftKMS | import("./services/algo.tx").BurnNft, testnet?: boolean, provider?: string) => Promise<import("@tatumio/api-client").TransactionHashKMS>;
44
+ };
45
+ };
46
+ blockchain: {
47
+ broadcast: typeof BlockchainAlgorandAlgoService.algoandBroadcast;
48
+ getBlock: typeof BlockchainAlgorandAlgoService.algorandGetBlock;
49
+ getCurrentBlock: typeof BlockchainAlgorandAlgoService.algorandGetCurrentBlock;
50
+ getBlockchainAccountBalance: typeof BlockchainAlgorandAlgoService.algorandGetBalance;
51
+ getTransaction: typeof BlockchainAlgorandAlgoService.algorandGetTransaction;
52
+ getPayTransactionByFromTo: typeof BlockchainAlgorandAlgoService.algorandGetPayTransactionsByFromTo;
53
+ };
54
+ node: {
55
+ indexerGetDriver: typeof BlockchainAlgorandAlgoService.algoNodeIndexerGetDriver;
56
+ getDriver: typeof BlockchainAlgorandAlgoService.algoNodeGetDriver;
57
+ postDriver: typeof BlockchainAlgorandAlgoService.algoNodePostDriver;
58
+ };
59
+ kms: {
60
+ getAllPending(signatures?: string): import("@tatumio/api-client").CancelablePromise<import("@tatumio/api-client").PendingTransaction[]>;
61
+ get: typeof import("@tatumio/api-client").SecurityKeyManagementSystemService.getPendingTransactionToSign;
62
+ complete: typeof import("@tatumio/api-client").SecurityKeyManagementSystemService.completePendingSignature;
63
+ delete: typeof import("@tatumio/api-client").SecurityKeyManagementSystemService.deletePendingTransactionToSign;
64
+ };
65
+ offchain: {
66
+ depositAddress: {
67
+ checkExists: (address: string, index?: number) => Promise<import("@tatumio/api-client").Account>;
68
+ create: typeof import("@tatumio/api-client").OffChainAccountService.generateDepositAddress;
69
+ createMultiple: typeof import("@tatumio/api-client").OffChainAccountService.generateDepositAddressesBatch;
70
+ assign: typeof import("@tatumio/api-client").OffChainAccountService.assignAddress;
71
+ remove: typeof import("@tatumio/api-client").OffChainAccountService.removeAddress;
72
+ getByAccount: typeof import("@tatumio/api-client").OffChainAccountService.getAllDepositAddresses;
73
+ };
74
+ withdrawal: {
75
+ getAll: (status?: "InProgress" | "Done" | "Cancelled", pageSize?: number, offset?: number) => Promise<import("@tatumio/api-client").WithdrawalObject[]>;
76
+ broadcast: typeof import("@tatumio/api-client").OffChainWithdrawalService.broadcastBlockchainTransaction;
77
+ create: typeof import("@tatumio/api-client").OffChainWithdrawalService.storeWithdrawal;
78
+ complete: typeof import("@tatumio/api-client").OffChainWithdrawalService.completeWithdrawal;
79
+ };
80
+ storeTokenAddress: typeof import("@tatumio/api-client").OffChainBlockchainService.storeTokenAddress;
81
+ };
82
+ getExchangeRate(basePair?: import("@tatumio/api-client").Fiat): import("@tatumio/api-client").CancelablePromise<import("@tatumio/api-client").ExchangeRate>;
83
+ storage: {
84
+ upload: typeof import("@tatumio/api-client").StorageIpfsService.storeIpfs;
85
+ get: typeof import("@tatumio/api-client").StorageIpfsService.getIpfsData;
86
+ };
87
+ subscriptions: typeof import("@tatumio/api-client").LedgerSubscriptionService;
88
+ ledger: {
89
+ customer: {
90
+ get: typeof import("@tatumio/api-client").LedgerCustomerService.getCustomerByExternalOrInternalId;
91
+ getAll: typeof import("@tatumio/api-client").LedgerCustomerService.findAllCustomers;
92
+ update: typeof import("@tatumio/api-client").LedgerCustomerService.updateCustomer;
93
+ activate: typeof import("@tatumio/api-client").LedgerCustomerService.activateCustomer;
94
+ deactivate: typeof import("@tatumio/api-client").LedgerCustomerService.deactivateCustomer;
95
+ enable: typeof import("@tatumio/api-client").LedgerCustomerService.enableCustomer;
96
+ disable: typeof import("@tatumio/api-client").LedgerCustomerService.disableCustomer;
97
+ };
98
+ orderBook: {
99
+ getHistorical: typeof import("@tatumio/api-client").LedgerOrderBookService.getHistoricalTradesBody;
100
+ getActiveBuyTrades: typeof import("@tatumio/api-client").LedgerOrderBookService.getBuyTradesBody;
101
+ getActiveSellTrades: typeof import("@tatumio/api-client").LedgerOrderBookService.getBuyTradesBody;
102
+ newTrade: typeof import("@tatumio/api-client").LedgerOrderBookService.storeTrade;
103
+ get: typeof import("@tatumio/api-client").LedgerOrderBookService.getTradeById;
104
+ cancel: typeof import("@tatumio/api-client").LedgerOrderBookService.deleteTrade;
105
+ cancelByAccount: typeof import("@tatumio/api-client").LedgerOrderBookService.deleteAccountTrades;
106
+ };
107
+ transaction: {
108
+ send: typeof import("@tatumio/api-client").LedgerTransactionService.sendTransaction;
109
+ sendMultiple: typeof import("@tatumio/api-client").LedgerTransactionService.sendTransactionBatch;
110
+ getAll: typeof import("@tatumio/api-client").LedgerTransactionService.getTransactions;
111
+ getAllByAccount: typeof import("@tatumio/api-client").LedgerTransactionService.getTransactionsByAccountId;
112
+ getAllByCustomer: typeof import("@tatumio/api-client").LedgerTransactionService.getTransactionsByCustomerId;
113
+ getAllByReference: typeof import("@tatumio/api-client").LedgerTransactionService.getTransactionsByReference;
114
+ countByAccount: (filter: import("@tatumio/api-client").TransactionFilter) => any;
115
+ countByCustomer: (filter: import("@tatumio/api-client").TransactionFilterCustomer) => any;
116
+ };
117
+ virtualCurrency: {
118
+ create: typeof import("@tatumio/api-client").LedgerVirtualCurrencyService.createCurrency;
119
+ mint: typeof import("@tatumio/api-client").LedgerVirtualCurrencyService.mintCurrency;
120
+ revoke: typeof import("@tatumio/api-client").LedgerVirtualCurrencyService.revokeCurrency;
121
+ getByName: typeof import("@tatumio/api-client").LedgerVirtualCurrencyService.getCurrency;
122
+ update: typeof import("@tatumio/api-client").LedgerVirtualCurrencyService.updateCurrency;
123
+ };
124
+ blockAmount: {
125
+ block: typeof import("@tatumio/api-client").LedgerAccountService.blockAmount;
126
+ unblock: typeof import("@tatumio/api-client").LedgerAccountService.deleteBlockAmount;
127
+ unblockWithTransaction: typeof import("@tatumio/api-client").LedgerAccountService.unblockAmountWithTransaction;
128
+ };
129
+ account: {
130
+ get: typeof import("@tatumio/api-client").LedgerAccountService.getAccountByAccountId;
131
+ getAll: typeof import("@tatumio/api-client").LedgerAccountService.getAllAccounts;
132
+ getByCustomerId: typeof import("@tatumio/api-client").LedgerAccountService.getAccountsByCustomerId;
133
+ getBalance: typeof import("@tatumio/api-client").LedgerAccountService.getAccountBalance;
134
+ create: typeof import("@tatumio/api-client").LedgerAccountService.createAccount;
135
+ createMultiple: typeof import("@tatumio/api-client").LedgerAccountService.createAccountBatch;
136
+ update: typeof import("@tatumio/api-client").LedgerAccountService.updateAccountByAccountId;
137
+ getBlockedAmountsByAccountId: typeof import("@tatumio/api-client").LedgerAccountService.getBlockAmountById;
138
+ activate: typeof import("@tatumio/api-client").LedgerAccountService.activateAccount;
139
+ deactivate: typeof import("@tatumio/api-client").LedgerAccountService.deactivateAccount;
140
+ freeze: typeof import("@tatumio/api-client").LedgerAccountService.freezeAccount;
141
+ unfreeze: typeof import("@tatumio/api-client").LedgerAccountService.unfreezeAccount;
142
+ generate: (account: import("@tatumio/api-client").CreateAccount, generateNewWalletFn: any, generateNewWallet?: boolean, testnet?: boolean, webhookUrl?: string) => Promise<any>;
143
+ };
144
+ };
145
+ security: {
146
+ checkMaliciousAddress: typeof import("@tatumio/api-client").SecurityAddressService.checkMalicousAddress;
147
+ };
148
+ tatum: {
149
+ getCredits: typeof import("@tatumio/api-client").TatumServiceService.getCredits;
150
+ getVersion: typeof import("@tatumio/api-client").TatumServiceService.getVersion;
151
+ freezeApiKey: typeof import("@tatumio/api-client").TatumServiceService.freezeApiKey;
152
+ unfreezeApiKey: typeof import("@tatumio/api-client").TatumServiceService.unfreezeApiKey;
153
+ };
154
+ nft: {
155
+ deployNFTSmartContract: typeof import("@tatumio/api-client").BlockchainNftService.nftDeployErc721;
156
+ addNFTMinter: typeof import("@tatumio/api-client").BlockchainNftService.nftAddMinter;
157
+ mintNFT: typeof import("@tatumio/api-client").BlockchainNftService.nftMintErc721;
158
+ mintMultipleNFTs: typeof import("@tatumio/api-client").BlockchainNftService.nftMintMultipleErc721;
159
+ burnNFT: typeof import("@tatumio/api-client").BlockchainNftService.nftBurnErc721;
160
+ transferNFT: typeof import("@tatumio/api-client").BlockchainNftService.nftTransferErc721;
161
+ updateNFTRoyalty: typeof import("@tatumio/api-client").BlockchainNftService.nftUpdateCashbackErc721;
162
+ getNFTTransaction: typeof import("@tatumio/api-client").BlockchainNftService.nftGetTransactErc721;
163
+ getNFTTransactionsByToken: typeof import("@tatumio/api-client").BlockchainNftService.nftGetTransactionByToken;
164
+ getNFTTransactionsByAddress: typeof import("@tatumio/api-client").BlockchainNftService.nftGetTransactionByAddress;
165
+ getNFTsByAddress: typeof import("@tatumio/api-client").BlockchainNftService.nftGetBalanceErc721;
166
+ getNFTProvenanceData: typeof import("@tatumio/api-client").BlockchainNftService.nftGetProvenanceDataErc721;
167
+ getNFTMetadataURI: typeof import("@tatumio/api-client").BlockchainNftService.nftGetMetadataErc721;
168
+ getNFTRoyalty: typeof import("@tatumio/api-client").BlockchainNftService.nftGetRoyaltyErc721;
169
+ getNFTAccountBalance: typeof import("@tatumio/api-client").BlockchainNftService.nftGetBalanceErc721;
170
+ getNFTImage: (chain: "ETH" | "MATIC" | "KCS" | "ONE" | "KLAY" | "BSC" | "CELO" | "FLOW" | "TRON" | "SOL", contractAddress: string, tokenId: string, account?: string) => Promise<{
171
+ originalUrl: string;
172
+ publicUrl: string;
173
+ }>;
174
+ prepareAddNftMinterAbstraction: (body: import("@tatumio/api-client").AddNftMinter | import("@tatumio/api-client").AddNftMinterKMS) => Promise<string[]>;
175
+ };
176
+ };
@@ -0,0 +1,29 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.TatumAlgoSDK = void 0;
4
+ const shared_core_1 = require("@tatumio/shared-core");
5
+ const shared_blockchain_abstract_1 = require("@tatumio/shared-blockchain-abstract");
6
+ const api_client_1 = require("@tatumio/api-client");
7
+ const algo_web_1 = require("./services/algo.web");
8
+ const algo_record_1 = require("./services/algo.record");
9
+ const algo_wallet_1 = require("./services/algo.wallet");
10
+ const algo_tx_1 = require("./services/algo.tx");
11
+ const blockchain = shared_core_1.Blockchain.ALGO;
12
+ const TatumAlgoSDK = (args) => {
13
+ const web = (0, algo_web_1.algoWeb)();
14
+ const txService = (0, algo_tx_1.algoTx)({ algoWeb: web });
15
+ return Object.assign(Object.assign({}, (0, shared_blockchain_abstract_1.abstractBlockchainSdk)(Object.assign(Object.assign({}, args), { blockchain }))), { algoWeb: web, record: (0, algo_record_1.algoRecord)(), wallet: (0, algo_wallet_1.algoWallet)(), transaction: txService.native, erc20: txService.erc20, erc721: txService.erc721, blockchain: {
16
+ broadcast: api_client_1.BlockchainAlgorandAlgoService.algoandBroadcast,
17
+ getBlock: api_client_1.BlockchainAlgorandAlgoService.algorandGetBlock,
18
+ getCurrentBlock: api_client_1.BlockchainAlgorandAlgoService.algorandGetCurrentBlock,
19
+ getBlockchainAccountBalance: api_client_1.BlockchainAlgorandAlgoService.algorandGetBalance,
20
+ getTransaction: api_client_1.BlockchainAlgorandAlgoService.algorandGetTransaction,
21
+ getPayTransactionByFromTo: api_client_1.BlockchainAlgorandAlgoService.algorandGetPayTransactionsByFromTo,
22
+ }, node: {
23
+ indexerGetDriver: api_client_1.BlockchainAlgorandAlgoService.algoNodeIndexerGetDriver,
24
+ getDriver: api_client_1.BlockchainAlgorandAlgoService.algoNodeGetDriver,
25
+ postDriver: api_client_1.BlockchainAlgorandAlgoService.algoNodePostDriver,
26
+ } });
27
+ };
28
+ exports.TatumAlgoSDK = TatumAlgoSDK;
29
+ //# sourceMappingURL=algo.sdk.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"algo.sdk.js","sourceRoot":"","sources":["../../../../../../packages/blockchain/algo/src/lib/algo.sdk.ts"],"names":[],"mappings":";;;AAAA,sDAAiD;AAEjD,oFAA2E;AAC3E,oDAAmE;AACnE,kDAA6C;AAC7C,wDAAmD;AACnD,wDAAmD;AACnD,gDAA2C;AAE3C,MAAM,UAAU,GAAG,wBAAU,CAAC,IAAI,CAAA;AAE3B,MAAM,YAAY,GAAG,CAAC,IAAkB,EAAE,EAAE;IACjD,MAAM,GAAG,GAAG,IAAA,kBAAO,GAAE,CAAA;IACrB,MAAM,SAAS,GAAG,IAAA,gBAAM,EAAC,EAAE,OAAO,EAAE,GAAG,EAAE,CAAC,CAAA;IAE1C,uCACK,IAAA,kDAAqB,kCACnB,IAAI,KACP,UAAU,IACV,KACF,OAAO,EAAE,GAAG,EACZ,MAAM,EAAE,IAAA,wBAAU,GAAE,EACpB,MAAM,EAAE,IAAA,wBAAU,GAAE,EACpB,WAAW,EAAE,SAAS,CAAC,MAAM,EAC7B,KAAK,EAAE,SAAS,CAAC,KAAK,EACtB,MAAM,EAAE,SAAS,CAAC,MAAM,EACxB,UAAU,EAAE;YACV,SAAS,EAAE,0CAA6B,CAAC,gBAAgB;YACzD,QAAQ,EAAE,0CAA6B,CAAC,gBAAgB;YACxD,eAAe,EAAE,0CAA6B,CAAC,uBAAuB;YACtE,2BAA2B,EAAE,0CAA6B,CAAC,kBAAkB;YAC7E,cAAc,EAAE,0CAA6B,CAAC,sBAAsB;YACpE,yBAAyB,EAAE,0CAA6B,CAAC,kCAAkC;SAC5F,EACD,IAAI,EAAE;YACJ,gBAAgB,EAAE,0CAA6B,CAAC,wBAAwB;YACxE,SAAS,EAAE,0CAA6B,CAAC,iBAAiB;YAC1D,UAAU,EAAE,0CAA6B,CAAC,kBAAkB;SAC7D,IACF;AACH,CAAC,CAAA;AA7BY,QAAA,YAAY,gBA6BxB"}
@@ -0,0 +1,17 @@
1
+ import { CancelablePromise } from '@tatumio/api-client';
2
+ export declare const algoRecord: () => {
3
+ /**
4
+ * Get log record
5
+ * <h4>1 credit per API call.</h4><br/><p>Gets log data from blockchain.</p>
6
+ * @param chain The blockchain to get the log record from
7
+ * @param id ID of the log record / transaction on the blockchain
8
+ * @returns any OK
9
+ * @throws ApiError
10
+ */
11
+ getLog(id: string): CancelablePromise<{
12
+ /**
13
+ * Data stored in the record.
14
+ */
15
+ data: string;
16
+ }>;
17
+ };
@@ -0,0 +1,23 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.algoRecord = void 0;
4
+ const api_client_1 = require("@tatumio/api-client");
5
+ const shared_core_1 = require("@tatumio/shared-core");
6
+ const algoRecord = () => {
7
+ return {
8
+ /**
9
+ * Get log record
10
+ * <h4>1 credit per API call.</h4><br/><p>Gets log data from blockchain.</p>
11
+ * @param chain The blockchain to get the log record from
12
+ * @param id ID of the log record / transaction on the blockchain
13
+ * @returns any OK
14
+ * @throws ApiError
15
+ */
16
+ getLog(id) {
17
+ // TODO: Open API bug
18
+ return api_client_1.BlockchainRecordService.getLog(shared_core_1.Blockchain.ALGO, id);
19
+ },
20
+ };
21
+ };
22
+ exports.algoRecord = algoRecord;
23
+ //# sourceMappingURL=algo.record.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"algo.record.js","sourceRoot":"","sources":["../../../../../../../packages/blockchain/algo/src/lib/services/algo.record.ts"],"names":[],"mappings":";;;AAAA,oDAAgF;AAChF,sDAAiD;AAE1C,MAAM,UAAU,GAAG,GAAG,EAAE;IAC7B,OAAO;QACL;;;;;;;WAOG;QACH,MAAM,CAAC,EAAU;YAMf,qBAAqB;YACrB,OAAO,oCAAuB,CAAC,MAAM,CAAC,wBAAU,CAAC,IAAW,EAAE,EAAE,CAAC,CAAA;QACnE,CAAC;KACF,CAAA;AACH,CAAC,CAAA;AApBY,QAAA,UAAU,cAoBtB"}
@@ -0,0 +1,166 @@
1
+ import { BurnNft as ApiBurnNft, BurnNftKMS as ApiBurnNftKMS, ChainTransferAlgoErc20 as ApiChainTransferAlgoErc20, ChainTransferAlgoErc20KMS as ApiChainTransferAlgoErc20KMS, DeployErc20 as ApiDeployErc20, DeployErc20KMS as ApiDeployErc20KMS, DeployNft as ApiDeployNft, DeployNftKMS as ApiDeployNftKMS, TransferAlgo as ApiTransferAlgo, TransferAlgoKMS as ApiTransferAlgoKMS, TransferErc721, TransferNft as ApiTransferNft, TransferNftKMS as ApiTransferNftKMS } from '@tatumio/api-client';
2
+ import { AlgoWeb } from './algo.web';
3
+ import { WithoutChain } from '@tatumio/shared-abstract-sdk';
4
+ export declare type TransferAlgo = Omit<ApiTransferAlgo, 'senderAccountId'> & Pick<TransferErc721, 'fee'>;
5
+ export declare type TransferAlgoKMS = Omit<ApiTransferAlgoKMS, 'senderAccountId'> & Pick<TransferErc721, 'fee'> & {
6
+ from: string;
7
+ };
8
+ export declare type DeployNftKMS = WithoutChain<ApiDeployNftKMS> & {
9
+ from: string;
10
+ url: string;
11
+ };
12
+ export declare type DeployNft = WithoutChain<ApiDeployNft> & {
13
+ url: string;
14
+ };
15
+ export declare type TransferNftKMS = WithoutChain<ApiTransferNftKMS> & {
16
+ from: string;
17
+ };
18
+ export declare type TransferNft = WithoutChain<ApiTransferNft>;
19
+ export declare type BurnNftKMS = WithoutChain<ApiBurnNftKMS> & {
20
+ from: string;
21
+ };
22
+ export declare type BurnNft = WithoutChain<ApiBurnNft>;
23
+ export declare type DeployErc20KMS = ApiDeployErc20KMS & {
24
+ from: string;
25
+ url: string;
26
+ };
27
+ export declare type DeployErc20 = ApiDeployErc20 & {
28
+ url: string;
29
+ };
30
+ export declare type ChainTransferAlgoErc20 = WithoutChain<ApiChainTransferAlgoErc20>;
31
+ export declare type ChainTransferAlgoErc20KMS = WithoutChain<ApiChainTransferAlgoErc20KMS>;
32
+ export declare const algoTx: (args: {
33
+ algoWeb: AlgoWeb;
34
+ }) => {
35
+ erc20: {
36
+ prepare: {
37
+ /**
38
+ * Sign Algorand create FT transaction with private key locally. Nothing is broadcast to the blockchain.
39
+ * @param testnet mainnet or testnet version
40
+ * @param body content of the transaction to broadcast
41
+ * @param provider url of the Algorand Server to connnect to. If not set, default public server will be used.
42
+ * @returns transaction data to be broadcast to blockchain.
43
+ */
44
+ createFTSignedTransaction: (body: DeployErc20 | DeployErc20KMS, testnet?: boolean, provider?: string) => Promise<string>;
45
+ /**
46
+ * Sign Algorand transfer FT transaction with private kwy locally. Nothing is broadcast to the blockchain.
47
+ * @param testnet mainnet or testnet version
48
+ * @param tx content of the transaction to broadcast
49
+ * @param provider url of the Algorand Server to connect to. If not set, default public server will be used.
50
+ * @returns transaction data to be broadcast to blockchain.
51
+ */
52
+ transferFTSignedTransaction: (body: ChainTransferAlgoErc20 | ChainTransferAlgoErc20KMS, testnet?: boolean, provider?: string) => Promise<string>;
53
+ /**
54
+ * Sign ALgorand burn FT transaction with private key locally. Nothing is broadcast to the blockchain.
55
+ * @param testnet mainnet or testnet version
56
+ * @param body content of the transaction to broadcast
57
+ * @param provider url of the Algorand Server to connect to. If not set, default public server will be used.
58
+ * @returns transaction data to be broadcast to blockchain.
59
+ */
60
+ burnFTSignedTransaction: (body: ChainTransferAlgoErc20 | ChainTransferAlgoErc20KMS, testnet?: boolean, provider?: string) => Promise<string>;
61
+ };
62
+ send: {
63
+ /**
64
+ * Send Algorand create FT transaction to the blockchain. This method broadcasts signed transaction to the blockchain.
65
+ * @param testnet mainnet or testnet version
66
+ * @param body content of the transaction to broadcast
67
+ * @param provider url of the Algorand Server to connect to. If not set, default public server will be used.
68
+ * @returns transaction id of the transaction in the blockchain.
69
+ */
70
+ createFTSignedTransaction: (body: DeployErc20 | DeployErc20KMS, testnet?: boolean, provider?: string) => Promise<import("@tatumio/api-client").TransactionHashKMS>;
71
+ /**
72
+ * Send Algorand transfer FT transaction to the blockchain. This method broadcasts signed transaction to the blockchain.
73
+ * @param testnet mainnet or testnet version
74
+ * @param body content of the transaction to broadcast
75
+ * @param provider url of the Algorand Server to connect to. If not set, default public server will be used.
76
+ * @returns transaction id of the transaction in the blockchain.
77
+ */
78
+ transferFTSignedTransaction: (body: ChainTransferAlgoErc20 | ChainTransferAlgoErc20KMS, testnet?: boolean, provider?: string) => Promise<import("@tatumio/api-client").TransactionHashKMS>;
79
+ /**
80
+ * Sned Algorand burn FT transaction to the blockchain. This method broadcasts signed transaction to the blockchain.
81
+ * @param testnet mainnet or testnet version
82
+ * @param body content of the transaction to broadcast
83
+ * @param provider url of the Algorand Server to connect to. If not set, default public server will be used.
84
+ * @returns transaction id of the transaction in the blockchain.
85
+ */
86
+ burnFTSignedTransaction: (body: ChainTransferAlgoErc20 | ChainTransferAlgoErc20KMS, testnet?: boolean, provider?: string) => Promise<import("@tatumio/api-client").TransactionHashKMS>;
87
+ };
88
+ };
89
+ erc721: {
90
+ prepare: {
91
+ /**
92
+ * Sign Algorand create NFT transaction with private key locally. Nothing is broadcast to the blockchain.
93
+ * @param testnet mainnet or testnet version
94
+ * @param body content of the transaction to broadcast
95
+ * @param provider url of the Algorand Server to connect to. If not set, default public server will be used.
96
+ * @returns transaction data to be broadcast to blockchain
97
+ */
98
+ createNFTSignedTransaction: (body: DeployNft | DeployNftKMS, testnet?: boolean, provider?: string) => Promise<string>;
99
+ /**
100
+ * Sign Algorand transfer NFT transaction with private key locally. Nothing is broadcast to the blockchain.
101
+ * @param testnet mainnet or testnet version
102
+ * @param body content of the transaction to broadcast
103
+ * @param provider url of the Algorand Server to connect to. If not set, default public server will be used.
104
+ * @returns transaction data to be broadcast to blockchain.
105
+ */
106
+ transferNFTSignedTransaction: (body: TransferNft | TransferNftKMS, testnet?: boolean, provider?: string) => Promise<string>;
107
+ /**
108
+ * Sign Algorand burn NFT transaction with private key locally. Nothing is broadcast to the blockchain.
109
+ * @param testnet mainnet or testnet version
110
+ * @param body content of the transaction to broadcast
111
+ * @param provider url of the Algorand Server to connect to. If not set, default public server will be used.
112
+ * @returns transaction data to be broadcast to blockchain.
113
+ */
114
+ burnNFTSignedTransaction: (body: BurnNft | BurnNftKMS, testnet?: boolean, provider?: string) => Promise<string>;
115
+ };
116
+ send: {
117
+ /**
118
+ * Send Algorand create NFT transaction to the blockchain. This method broadcasts signed transaction to the blockchain.
119
+ * @param testnet mainnet or testnet version
120
+ * @param body content of the transaction to broadcast
121
+ * @param provider url of the Algorand Server to connect to. If not set, default public server will be used.
122
+ * @returns transaction id of the transaction in the blockchain
123
+ */
124
+ createNFTSignedTransaction: (body: DeployNft | DeployNftKMS, testnet?: boolean, provider?: string) => Promise<import("@tatumio/api-client").TransactionHashKMS>;
125
+ /**
126
+ * Send Algorand Transfer NFT transaction to the blockchain. This method broadcasts signed transaction to the blockchain.
127
+ * @param testnet mainnet or testnet version
128
+ * @param body content of the transaction to broadcast
129
+ * @param provider url of the Algorand Server to connect to. If not set, default public server will be used.
130
+ * @returns transaction id of the transaction in the blockchain.
131
+ */
132
+ transferNFTSignedTransaction: (body: TransferNft | TransferNftKMS, testnet?: boolean, provider?: string) => Promise<import("@tatumio/api-client").TransactionHashKMS>;
133
+ /**
134
+ * Send Algorand burn NFT transaction to the blockchain. This method broadcasts signed transaction to the blockchain.
135
+ * @param testnet mainnet or testnet version
136
+ * @param body content of the transaction to broadcast
137
+ * @param provider url of the Algorand Server to connect to. If not set, default public server will be used.
138
+ * @returns transaction id of the transaction in the blockchain.
139
+ */
140
+ burnNFTSignedTransaction: (body: BurnNft | BurnNftKMS, testnet?: boolean, provider?: string) => Promise<import("@tatumio/api-client").TransactionHashKMS>;
141
+ };
142
+ };
143
+ native: {
144
+ prepare: {
145
+ /**
146
+ * Algorand transaction signing
147
+ * @param testnet if the algorand node is testnet or not
148
+ * @param body content of the transaction to broadcast
149
+ * @param provider url of the algorand server endpoint for purestake.io restapi
150
+ * @returns transaction data to be broadcast to blockchain
151
+ */
152
+ signedTransaction: (body: TransferAlgo | TransferAlgoKMS, testnet?: boolean, provider?: string) => Promise<string>;
153
+ };
154
+ send: {
155
+ /**
156
+ * Send Algorand transaction to the blockchain. This method broadcasts signed transaction to the blockchain.
157
+ * This operation is irreversible.
158
+ * @param testnet mainnet or testnet version
159
+ * @param body content of the transaction to broadcast
160
+ * @param provider url of the Algorand Server to connect to. If not set, default public server will be used.
161
+ * @returns transaction id of the transaction in the blockchain
162
+ */
163
+ signedTransaction: (body: TransferAlgo | TransferAlgoKMS, testnet?: boolean, provider?: string) => Promise<import("@tatumio/api-client").TransactionHashKMS>;
164
+ };
165
+ };
166
+ };
@@ -0,0 +1,272 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.algoTx = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const api_client_1 = require("@tatumio/api-client");
6
+ const algosdk = (0, tslib_1.__importStar)(require("algosdk"));
7
+ // No types for base32.js
8
+ // @ts-ignore
9
+ const base32_js_1 = (0, tslib_1.__importDefault)(require("base32.js"));
10
+ const algo_wallet_1 = require("./algo.wallet");
11
+ const shared_abstract_sdk_1 = require("@tatumio/shared-abstract-sdk");
12
+ function isTransferAlgoKMS(input) {
13
+ return input.signatureId !== undefined;
14
+ }
15
+ const prepareSignedTransaction = (body, testnet = false, algoWeb, provider) => (0, tslib_1.__awaiter)(void 0, void 0, void 0, function* () {
16
+ var _a;
17
+ const algodClient = algoWeb.getClient(testnet, provider);
18
+ const params = yield algodClient.getTransactionParams().do();
19
+ const decoder = new base32_js_1.default.Decoder({ type: 'rfc4648' });
20
+ const enc = new TextEncoder();
21
+ const note = enc.encode((_a = body.senderNote) !== null && _a !== void 0 ? _a : '');
22
+ const bodyn = algosdk.makePaymentTxnWithSuggestedParams(body.account, body.address, Number(body.amount) * 1000000, undefined, note, Object.assign(Object.assign({}, params), { fee: Number(body.fee) * 1000000, flatFee: true }));
23
+ if (isTransferAlgoKMS(body)) {
24
+ return JSON.stringify(bodyn);
25
+ }
26
+ const secretKey = new Uint8Array(decoder.write(body.privateKey).buf);
27
+ const signedTxn = bodyn.signTxn(secretKey);
28
+ return Buffer.from(signedTxn).toString('hex');
29
+ });
30
+ const prepareCreateNFTSignedTransaction = (body, testnet = false, algoWeb, provider) => (0, tslib_1.__awaiter)(void 0, void 0, void 0, function* () {
31
+ const algodClient = algoWeb.getClient(testnet, provider);
32
+ const params = yield algodClient.getTransactionParams().do();
33
+ const decoder = new base32_js_1.default.Decoder({ type: 'rfc4648' });
34
+ const from = (0, shared_abstract_sdk_1.isWithSignatureId)(body)
35
+ ? body.from
36
+ : (0, algo_wallet_1.algoWallet)().generateAddressFromPrivatetKey(body.fromPrivateKey);
37
+ const txn = algosdk.makeAssetCreateTxnWithSuggestedParams(from, undefined, 1, 0, false, from, undefined, undefined, undefined, body.symbol, body.name, body.url, undefined, params);
38
+ if ((0, shared_abstract_sdk_1.isWithSignatureId)(body)) {
39
+ return JSON.stringify(txn);
40
+ }
41
+ const secretKey = new Uint8Array(decoder.write(body.fromPrivateKey).buf);
42
+ const signedTxn = txn.signTxn(secretKey);
43
+ return Buffer.from(signedTxn).toString('hex');
44
+ });
45
+ const prepareTransferNFTSignedTransaction = (body, testnet = false, algoWeb, provider) => (0, tslib_1.__awaiter)(void 0, void 0, void 0, function* () {
46
+ const algodClient = algoWeb.getClient(testnet, provider);
47
+ const params = yield algodClient.getTransactionParams().do();
48
+ const decoder = new base32_js_1.default.Decoder({ type: 'rfc4648' });
49
+ const from = (0, shared_abstract_sdk_1.isWithSignatureId)(body)
50
+ ? body.from
51
+ : (0, algo_wallet_1.algoWallet)().generateAddressFromPrivatetKey(body.fromPrivateKey);
52
+ if (!body.value) {
53
+ throw new Error('No value specified');
54
+ }
55
+ const txn = algosdk.makeAssetTransferTxnWithSuggestedParams(from, body.to, undefined, undefined, Number.parseInt(body.value), undefined, Number(body.contractAddress), params, undefined);
56
+ if ((0, shared_abstract_sdk_1.isWithSignatureId)(body)) {
57
+ return JSON.stringify(txn);
58
+ }
59
+ const secretKey = new Uint8Array(decoder.write(body.fromPrivateKey).buf);
60
+ const signedTxn = txn.signTxn(secretKey);
61
+ return Buffer.from(signedTxn).toString('hex');
62
+ });
63
+ const prepareBurnNFTSignedTransaction = (body, testnet = false, algoWeb, provider) => (0, tslib_1.__awaiter)(void 0, void 0, void 0, function* () {
64
+ const algodClient = algoWeb.getClient(testnet, provider);
65
+ const params = yield algodClient.getTransactionParams().do();
66
+ const decoder = new base32_js_1.default.Decoder({ type: 'rfc4648' });
67
+ const txn = algosdk.makeAssetDestroyTxnWithSuggestedParams((0, shared_abstract_sdk_1.isWithSignatureId)(body) ? body.from : (0, algo_wallet_1.algoWallet)().generateAddressFromPrivatetKey(body.fromPrivateKey), undefined, Number(body.contractAddress), params, undefined);
68
+ if ((0, shared_abstract_sdk_1.isWithSignatureId)(body)) {
69
+ return JSON.stringify(txn);
70
+ }
71
+ const secretKey = new Uint8Array(decoder.write(body.fromPrivateKey).buf);
72
+ const signedTxn = txn.signTxn(secretKey);
73
+ return Buffer.from(signedTxn).toString('hex');
74
+ });
75
+ const prepareCreateFTSignedTransaction = (body, testnet = false, algoWeb, provider) => (0, tslib_1.__awaiter)(void 0, void 0, void 0, function* () {
76
+ const algodClient = algoWeb.getClient(testnet, provider);
77
+ const params = yield algodClient.getTransactionParams().do();
78
+ const decoder = new base32_js_1.default.Decoder({ type: 'rfc4648' });
79
+ const from = (0, shared_abstract_sdk_1.isWithSignatureId)(body)
80
+ ? body.from
81
+ : (0, algo_wallet_1.algoWallet)().generateAddressFromPrivatetKey(body.fromPrivateKey);
82
+ const txn = algosdk.makeAssetCreateTxnWithSuggestedParams(from, undefined, Number(body.supply), Number(body.digits), false, from, undefined, undefined, undefined, body.symbol, body.name, body.url, undefined, params);
83
+ if ((0, shared_abstract_sdk_1.isWithSignatureId)(body)) {
84
+ return JSON.stringify(txn);
85
+ }
86
+ const secretKey = new Uint8Array(decoder.write(body.fromPrivateKey).buf);
87
+ const signedTxn = txn.signTxn(secretKey);
88
+ return Buffer.from(signedTxn).toString('hex');
89
+ });
90
+ const prepareTransferFTSignedTransaction = (body, testnet = false, algoWeb, provider) => (0, tslib_1.__awaiter)(void 0, void 0, void 0, function* () {
91
+ const algodClient = algoWeb.getClient(testnet, provider);
92
+ const params = yield algodClient.getTransactionParams().do();
93
+ const decoder = new base32_js_1.default.Decoder({ type: 'rfc4648' });
94
+ const from = (0, shared_abstract_sdk_1.isWithSignatureId)(body)
95
+ ? body.from
96
+ : (0, algo_wallet_1.algoWallet)().generateAddressFromPrivatetKey(body.fromPrivateKey);
97
+ const txn = algosdk.makeAssetTransferTxnWithSuggestedParams(from, body.to, undefined, undefined, Number.parseInt(body.amount), undefined, Number(body.contractAddress), params, undefined);
98
+ if ((0, shared_abstract_sdk_1.isWithSignatureId)(body)) {
99
+ return JSON.stringify(txn);
100
+ }
101
+ const secretKey = new Uint8Array(decoder.write(body.fromPrivateKey).buf);
102
+ const signedTxn = txn.signTxn(secretKey);
103
+ return Buffer.from(signedTxn).toString('hex');
104
+ });
105
+ const prepareBurnFTSignedTransaction = (body, testnet = false, algoWeb, provider) => (0, tslib_1.__awaiter)(void 0, void 0, void 0, function* () {
106
+ const algodClient = algoWeb.getClient(testnet, provider);
107
+ const params = yield algodClient.getTransactionParams().do();
108
+ const decoder = new base32_js_1.default.Decoder({ type: 'rfc4648' });
109
+ const from = (0, shared_abstract_sdk_1.isWithSignatureId)(body)
110
+ ? body.from
111
+ : (0, algo_wallet_1.algoWallet)().generateAddressFromPrivatetKey(body.fromPrivateKey);
112
+ const txn = algosdk.makeAssetDestroyTxnWithSuggestedParams(from, undefined, Number(body.contractAddress), params, undefined);
113
+ if ((0, shared_abstract_sdk_1.isWithSignatureId)(body)) {
114
+ return JSON.stringify(txn);
115
+ }
116
+ const secretKey = new Uint8Array(decoder.write(body.fromPrivateKey).buf);
117
+ const signedTxn = txn.signTxn(secretKey);
118
+ return Buffer.from(signedTxn).toString('hex');
119
+ });
120
+ const algoTx = (args) => {
121
+ return {
122
+ erc20: {
123
+ prepare: {
124
+ /**
125
+ * Sign Algorand create FT transaction with private key locally. Nothing is broadcast to the blockchain.
126
+ * @param testnet mainnet or testnet version
127
+ * @param body content of the transaction to broadcast
128
+ * @param provider url of the Algorand Server to connnect to. If not set, default public server will be used.
129
+ * @returns transaction data to be broadcast to blockchain.
130
+ */
131
+ createFTSignedTransaction: (body, testnet = false, provider) => (0, tslib_1.__awaiter)(void 0, void 0, void 0, function* () { return prepareCreateFTSignedTransaction(body, testnet, args.algoWeb, provider); }),
132
+ /**
133
+ * Sign Algorand transfer FT transaction with private kwy locally. Nothing is broadcast to the blockchain.
134
+ * @param testnet mainnet or testnet version
135
+ * @param tx content of the transaction to broadcast
136
+ * @param provider url of the Algorand Server to connect to. If not set, default public server will be used.
137
+ * @returns transaction data to be broadcast to blockchain.
138
+ */
139
+ transferFTSignedTransaction: (body, testnet = false, provider) => (0, tslib_1.__awaiter)(void 0, void 0, void 0, function* () { return prepareTransferFTSignedTransaction(body, testnet, args.algoWeb, provider); }),
140
+ /**
141
+ * Sign ALgorand burn FT transaction with private key locally. Nothing is broadcast to the blockchain.
142
+ * @param testnet mainnet or testnet version
143
+ * @param body content of the transaction to broadcast
144
+ * @param provider url of the Algorand Server to connect to. If not set, default public server will be used.
145
+ * @returns transaction data to be broadcast to blockchain.
146
+ */
147
+ burnFTSignedTransaction: (body, testnet = false, provider) => (0, tslib_1.__awaiter)(void 0, void 0, void 0, function* () { return prepareBurnFTSignedTransaction(body, testnet, args.algoWeb, provider); }),
148
+ },
149
+ send: {
150
+ /**
151
+ * Send Algorand create FT transaction to the blockchain. This method broadcasts signed transaction to the blockchain.
152
+ * @param testnet mainnet or testnet version
153
+ * @param body content of the transaction to broadcast
154
+ * @param provider url of the Algorand Server to connect to. If not set, default public server will be used.
155
+ * @returns transaction id of the transaction in the blockchain.
156
+ */
157
+ createFTSignedTransaction: (body, testnet = false, provider) => (0, tslib_1.__awaiter)(void 0, void 0, void 0, function* () {
158
+ return api_client_1.BlockchainAlgorandAlgoService.algoandBroadcast(Object.assign({ txData: yield prepareCreateFTSignedTransaction(body, testnet, args.algoWeb, provider) }, ((0, shared_abstract_sdk_1.isWithSignatureId)(body) && { signatureId: body.signatureId })));
159
+ }),
160
+ /**
161
+ * Send Algorand transfer FT transaction to the blockchain. This method broadcasts signed transaction to the blockchain.
162
+ * @param testnet mainnet or testnet version
163
+ * @param body content of the transaction to broadcast
164
+ * @param provider url of the Algorand Server to connect to. If not set, default public server will be used.
165
+ * @returns transaction id of the transaction in the blockchain.
166
+ */
167
+ transferFTSignedTransaction: (body, testnet = false, provider) => (0, tslib_1.__awaiter)(void 0, void 0, void 0, function* () {
168
+ return api_client_1.BlockchainAlgorandAlgoService.algoandBroadcast({
169
+ txData: yield prepareTransferFTSignedTransaction(body, testnet, args.algoWeb, provider),
170
+ });
171
+ }),
172
+ /**
173
+ * Sned Algorand burn FT transaction to the blockchain. This method broadcasts signed transaction to the blockchain.
174
+ * @param testnet mainnet or testnet version
175
+ * @param body content of the transaction to broadcast
176
+ * @param provider url of the Algorand Server to connect to. If not set, default public server will be used.
177
+ * @returns transaction id of the transaction in the blockchain.
178
+ */
179
+ burnFTSignedTransaction: (body, testnet = false, provider) => (0, tslib_1.__awaiter)(void 0, void 0, void 0, function* () {
180
+ return api_client_1.BlockchainAlgorandAlgoService.algoandBroadcast(Object.assign({ txData: yield prepareBurnFTSignedTransaction(body, testnet, args.algoWeb, provider) }, ((0, shared_abstract_sdk_1.isWithSignatureId)(body) && { signatureId: body.signatureId })));
181
+ }),
182
+ },
183
+ },
184
+ erc721: {
185
+ prepare: {
186
+ /**
187
+ * Sign Algorand create NFT transaction with private key locally. Nothing is broadcast to the blockchain.
188
+ * @param testnet mainnet or testnet version
189
+ * @param body content of the transaction to broadcast
190
+ * @param provider url of the Algorand Server to connect to. If not set, default public server will be used.
191
+ * @returns transaction data to be broadcast to blockchain
192
+ */
193
+ createNFTSignedTransaction: (body, testnet = false, provider) => (0, tslib_1.__awaiter)(void 0, void 0, void 0, function* () { return prepareCreateNFTSignedTransaction(body, testnet, args.algoWeb, provider); }),
194
+ /**
195
+ * Sign Algorand transfer NFT transaction with private key locally. Nothing is broadcast to the blockchain.
196
+ * @param testnet mainnet or testnet version
197
+ * @param body content of the transaction to broadcast
198
+ * @param provider url of the Algorand Server to connect to. If not set, default public server will be used.
199
+ * @returns transaction data to be broadcast to blockchain.
200
+ */
201
+ transferNFTSignedTransaction: (body, testnet = false, provider) => (0, tslib_1.__awaiter)(void 0, void 0, void 0, function* () { return prepareTransferNFTSignedTransaction(body, testnet, args.algoWeb, provider); }),
202
+ /**
203
+ * Sign Algorand burn NFT transaction with private key locally. Nothing is broadcast to the blockchain.
204
+ * @param testnet mainnet or testnet version
205
+ * @param body content of the transaction to broadcast
206
+ * @param provider url of the Algorand Server to connect to. If not set, default public server will be used.
207
+ * @returns transaction data to be broadcast to blockchain.
208
+ */
209
+ burnNFTSignedTransaction: (body, testnet = false, provider) => (0, tslib_1.__awaiter)(void 0, void 0, void 0, function* () { return prepareBurnNFTSignedTransaction(body, testnet, args.algoWeb, provider); }),
210
+ },
211
+ send: {
212
+ /**
213
+ * Send Algorand create NFT transaction to the blockchain. This method broadcasts signed transaction to the blockchain.
214
+ * @param testnet mainnet or testnet version
215
+ * @param body content of the transaction to broadcast
216
+ * @param provider url of the Algorand Server to connect to. If not set, default public server will be used.
217
+ * @returns transaction id of the transaction in the blockchain
218
+ */
219
+ createNFTSignedTransaction: (body, testnet = false, provider) => (0, tslib_1.__awaiter)(void 0, void 0, void 0, function* () {
220
+ return api_client_1.BlockchainAlgorandAlgoService.algoandBroadcast(Object.assign({ txData: yield prepareCreateNFTSignedTransaction(body, testnet, args.algoWeb, provider) }, ((0, shared_abstract_sdk_1.isWithSignatureId)(body) && { signatureId: body.signatureId })));
221
+ }),
222
+ /**
223
+ * Send Algorand Transfer NFT transaction to the blockchain. This method broadcasts signed transaction to the blockchain.
224
+ * @param testnet mainnet or testnet version
225
+ * @param body content of the transaction to broadcast
226
+ * @param provider url of the Algorand Server to connect to. If not set, default public server will be used.
227
+ * @returns transaction id of the transaction in the blockchain.
228
+ */
229
+ transferNFTSignedTransaction: (body, testnet = false, provider) => (0, tslib_1.__awaiter)(void 0, void 0, void 0, function* () {
230
+ return api_client_1.BlockchainAlgorandAlgoService.algoandBroadcast(Object.assign({ txData: yield prepareTransferNFTSignedTransaction(body, testnet, args.algoWeb, provider) }, ((0, shared_abstract_sdk_1.isWithSignatureId)(body) && { signatureId: body.signatureId })));
231
+ }),
232
+ /**
233
+ * Send Algorand burn NFT transaction to the blockchain. This method broadcasts signed transaction to the blockchain.
234
+ * @param testnet mainnet or testnet version
235
+ * @param body content of the transaction to broadcast
236
+ * @param provider url of the Algorand Server to connect to. If not set, default public server will be used.
237
+ * @returns transaction id of the transaction in the blockchain.
238
+ */
239
+ burnNFTSignedTransaction: (body, testnet = false, provider) => (0, tslib_1.__awaiter)(void 0, void 0, void 0, function* () {
240
+ return api_client_1.BlockchainAlgorandAlgoService.algoandBroadcast(Object.assign({ txData: yield prepareBurnNFTSignedTransaction(body, testnet, args.algoWeb, provider) }, ((0, shared_abstract_sdk_1.isWithSignatureId)(body) && { signatureId: body.signatureId })));
241
+ }),
242
+ },
243
+ },
244
+ native: {
245
+ prepare: {
246
+ /**
247
+ * Algorand transaction signing
248
+ * @param testnet if the algorand node is testnet or not
249
+ * @param body content of the transaction to broadcast
250
+ * @param provider url of the algorand server endpoint for purestake.io restapi
251
+ * @returns transaction data to be broadcast to blockchain
252
+ */
253
+ signedTransaction: (body, testnet = false, provider) => (0, tslib_1.__awaiter)(void 0, void 0, void 0, function* () { return prepareSignedTransaction(body, testnet, args.algoWeb, provider); }),
254
+ },
255
+ send: {
256
+ /**
257
+ * Send Algorand transaction to the blockchain. This method broadcasts signed transaction to the blockchain.
258
+ * This operation is irreversible.
259
+ * @param testnet mainnet or testnet version
260
+ * @param body content of the transaction to broadcast
261
+ * @param provider url of the Algorand Server to connect to. If not set, default public server will be used.
262
+ * @returns transaction id of the transaction in the blockchain
263
+ */
264
+ signedTransaction: (body, testnet = false, provider) => (0, tslib_1.__awaiter)(void 0, void 0, void 0, function* () {
265
+ return api_client_1.BlockchainAlgorandAlgoService.algoandBroadcast(Object.assign({ txData: yield prepareSignedTransaction(body, testnet, args.algoWeb, provider) }, (isTransferAlgoKMS(body) && { signatureId: body.signatureId })));
266
+ }),
267
+ },
268
+ },
269
+ };
270
+ };
271
+ exports.algoTx = algoTx;
272
+ //# sourceMappingURL=algo.tx.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"algo.tx.js","sourceRoot":"","sources":["../../../../../../../packages/blockchain/algo/src/lib/services/algo.tx.ts"],"names":[],"mappings":";;;;AAAA,oDAe4B;AAE5B,8DAAkC;AAClC,yBAAyB;AACzB,aAAa;AACb,uEAA8B;AAC9B,+CAA0C;AAC1C,sEAA8E;AAE9E,SAAS,iBAAiB,CAAC,KAAqC;IAC9D,OAAQ,KAAyB,CAAC,WAAW,KAAK,SAAS,CAAA;AAC7D,CAAC;AAOD,MAAM,wBAAwB,GAAG,CAC/B,IAAoC,EACpC,OAAO,GAAG,KAAK,EACf,OAAgB,EAChB,QAAiB,EACjB,EAAE;;IACF,MAAM,WAAW,GAAG,OAAO,CAAC,SAAS,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAA;IACxD,MAAM,MAAM,GAAG,MAAM,WAAW,CAAC,oBAAoB,EAAE,CAAC,EAAE,EAAE,CAAA;IAE5D,MAAM,OAAO,GAAG,IAAI,mBAAM,CAAC,OAAO,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC,CAAA;IACvD,MAAM,GAAG,GAAG,IAAI,WAAW,EAAE,CAAA;IAC7B,MAAM,IAAI,GAAG,GAAG,CAAC,MAAM,CAAC,MAAA,IAAI,CAAC,UAAU,mCAAI,EAAE,CAAC,CAAA;IAC9C,MAAM,KAAK,GAAG,OAAO,CAAC,iCAAi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AAI,CAAC,IAAI,EAAE,WAAW,EAAE,IAAI,CAAC,WAAW,EAAE,CAAC,EACjE,CAAA;kBAAA;aACL;SACF;QAED,MAAM,EAAE;YACN,OAAO,EAAE;gBACP;;;;;;mBAMG;gBACH,iBAAiB,EAAE,CAAO,IAAoC,EAAE,OAAO,GAAG,KAAK,EAAE,QAAiB,EAAE,EAAE,+DACpG,OAAA,wBAAwB,CAAC,IAAI,EAAE,OAAO,EAAE,IAAI,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAA,GAAA;aAClE;YACD,IAAI,EAAE;gBACJ;;;;;;;mBAOG;gBACH,iBAAiB,EAAE,CAAO,IAAoC,EAAE,OAAO,GAAG,KAAK,EAAE,QAAiB,EAAE,EAAE;oBACpG,OAAA,0CAA6B,CAAC,gBAAgB,iBAC5C,MAAM,EAAE,MAAM,wBAAwB,CAAC,IAAI,EAAE,OAAO,EAAE,IAAI,CAAC,OAAO,EAAE,QAAQ,CAAC,IAC1E,CAAC,iBAAiB,CAAC,IAAI,CAAC,IAAI,EAAE,WAAW,EAAE,IAAI,CAAC,WAAW,EAAE,CAAC,EACjE,CAAA;kBAAA;aACL;SACF;KACF,CAAA;AACH,CAAC,CAAA;AA7MY,QAAA,MAAM,UA6MlB"}
@@ -0,0 +1,15 @@
1
+ import { AlgoWallet } from '@tatumio/api-client';
2
+ export declare const algoWallet: () => {
3
+ /**
4
+ * Generate wallet
5
+ * @param mnemonic optional mnemonic seed to use. If not present, new one will be generated
6
+ * @returns wallet or a combination of address and private key
7
+ */
8
+ generateWallet(mnemonic?: string): AlgoWallet;
9
+ /**
10
+ * Generate Algo Address From Private Key
11
+ * @param privateKey Private key to use
12
+ * @returns blockchain address
13
+ */
14
+ generateAddressFromPrivatetKey(privateKey: string): string;
15
+ };
@@ -0,0 +1,39 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.algoWallet = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const algosdk = (0, tslib_1.__importStar)(require("algosdk"));
6
+ // No types for base32.js
7
+ // @ts-ignore
8
+ const base32_js_1 = (0, tslib_1.__importDefault)(require("base32.js"));
9
+ const algoWallet = () => {
10
+ return {
11
+ /**
12
+ * Generate wallet
13
+ * @param mnemonic optional mnemonic seed to use. If not present, new one will be generated
14
+ * @returns wallet or a combination of address and private key
15
+ */
16
+ generateWallet(mnemonic) {
17
+ const account = mnemonic ? algosdk.mnemonicToSecretKey(mnemonic) : algosdk.generateAccount();
18
+ const encoder = new base32_js_1.default.Encoder({ type: 'rfc4648' });
19
+ const secret = encoder.write(account.sk).finalize();
20
+ return {
21
+ address: account.addr,
22
+ secret,
23
+ };
24
+ },
25
+ /**
26
+ * Generate Algo Address From Private Key
27
+ * @param privateKey Private key to use
28
+ * @returns blockchain address
29
+ */
30
+ generateAddressFromPrivatetKey(privateKey) {
31
+ const decoder = new base32_js_1.default.Decoder({ type: 'rfc4648' });
32
+ const secretKey = decoder.write(privateKey).buf;
33
+ const mn = algosdk.secretKeyToMnemonic(secretKey);
34
+ return algosdk.mnemonicToSecretKey(mn).addr;
35
+ },
36
+ };
37
+ };
38
+ exports.algoWallet = algoWallet;
39
+ //# sourceMappingURL=algo.wallet.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"algo.wallet.js","sourceRoot":"","sources":["../../../../../../../packages/blockchain/algo/src/lib/services/algo.wallet.ts"],"names":[],"mappings":";;;;AACA,8DAAkC;AAClC,yBAAyB;AACzB,aAAa;AACb,uEAA8B;AAEvB,MAAM,UAAU,GAAG,GAAG,EAAE;IAC7B,OAAO;QACL;;;;WAIG;QACH,cAAc,CAAC,QAAiB;YAC9B,MAAM,OAAO,GAAG,QAAQ,CAAC,CAAC,CAAC,OAAO,CAAC,mBAAmB,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,eAAe,EAAE,CAAA;YAC5F,MAAM,OAAO,GAAG,IAAI,mBAAM,CAAC,OAAO,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC,CAAA;YACvD,MAAM,MAAM,GAAG,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC,QAAQ,EAAE,CAAA;YAEnD,OAAO;gBACL,OAAO,EAAE,OAAO,CAAC,IAAI;gBACrB,MAAM;aACP,CAAA;QACH,CAAC;QACD;;;;WAIG;QACH,8BAA8B,CAAC,UAAkB;YAC/C,MAAM,OAAO,GAAG,IAAI,mBAAM,CAAC,OAAO,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC,CAAA;YACvD,MAAM,SAAS,GAAG,OAAO,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC,GAAG,CAAA;YAC/C,MAAM,EAAE,GAAG,OAAO,CAAC,mBAAmB,CAAC,SAAS,CAAC,CAAA;YAEjD,OAAO,OAAO,CAAC,mBAAmB,CAAC,EAAE,CAAC,CAAC,IAAI,CAAA;QAC7C,CAAC;KACF,CAAA;AACH,CAAC,CAAA;AA9BY,QAAA,UAAU,cA8BtB"}
@@ -0,0 +1,18 @@
1
+ import * as algosdk from 'algosdk';
2
+ export interface AlgoWeb {
3
+ /**
4
+ * Algod V2 Client
5
+ * @param testnet if the algorand node is testnet or not
6
+ * @param provider url of the algorand server endpoint
7
+ * @returns algorand Client
8
+ */
9
+ getClient(testnet: boolean, provider?: string): algosdk.Algodv2;
10
+ /**
11
+ * Algo Indexer Client
12
+ * @param testnet if the algorand node is testnet or not
13
+ * @param provider url of the algorand server endpoint
14
+ * @returns algorand Indexer Client
15
+ */
16
+ getIndexerClient(testnet: boolean, provider?: string): algosdk.Indexer;
17
+ }
18
+ export declare const algoWeb: () => AlgoWeb;
@@ -0,0 +1,50 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.algoWeb = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const algosdk = (0, tslib_1.__importStar)(require("algosdk"));
6
+ const url_parse_1 = (0, tslib_1.__importDefault)(require("url-parse"));
7
+ const algoWeb = () => {
8
+ return {
9
+ getClient: (testnet, provider) => {
10
+ const tokenValue = testnet
11
+ ? process.env['TATUM_ALGORAND_TESTNET_TOKEN']
12
+ : process.env['TATUM_ALGORAND_MAINNET_TOKEN'];
13
+ if (!tokenValue) {
14
+ throw new Error('No ALGORAND token specified');
15
+ }
16
+ if (provider) {
17
+ return new algosdk.Algodv2(tokenValue !== null && tokenValue !== void 0 ? tokenValue : 'DUMMYTOKEN', provider, (0, url_parse_1.default)(provider).port);
18
+ }
19
+ else {
20
+ const server = testnet
21
+ ? process.env['TATUM_ALGORAND_TESTNET_THIRD_API_ALGOD_URL']
22
+ : process.env['TATUM_ALGORAND_MAINNET_THIRD_API_ALGOD_URL'];
23
+ return new algosdk.Algodv2({
24
+ 'X-API-Key': tokenValue,
25
+ }, server);
26
+ }
27
+ },
28
+ getIndexerClient: (testnet, provider) => {
29
+ const tokenValue = testnet
30
+ ? process.env['TATUM_ALGORAND_TESTNET_TOKEN']
31
+ : process.env['TATUM_ALGORAND_MAINNET_TOKEN'];
32
+ if (!tokenValue) {
33
+ throw new Error('No ALGORAND token specified');
34
+ }
35
+ if (provider) {
36
+ return new algosdk.Indexer(tokenValue !== null && tokenValue !== void 0 ? tokenValue : 'DUMMYTOKEN', provider, (0, url_parse_1.default)(provider).port);
37
+ }
38
+ else {
39
+ const server = testnet
40
+ ? process.env['TATUM_ALGORAND_TESTNET_THIRD_API_ALGOD_URL']
41
+ : process.env['TATUM_ALGORAND_MAINNET_THIRD_API_ALGOD_URL'];
42
+ return new algosdk.Indexer({
43
+ 'X-API-Key': tokenValue,
44
+ }, server);
45
+ }
46
+ },
47
+ };
48
+ };
49
+ exports.algoWeb = algoWeb;
50
+ //# sourceMappingURL=algo.web.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"algo.web.js","sourceRoot":"","sources":["../../../../../../../packages/blockchain/algo/src/lib/services/algo.web.ts"],"names":[],"mappings":";;;;AAAA,8DAAkC;AAClC,uEAA2B;AAmBpB,MAAM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