Skip to content

Commit

Permalink
feat: switch cli to @stacks/transactions
Browse files Browse the repository at this point in the history
  • Loading branch information
yknl committed Sep 16, 2020
1 parent 30e446f commit 833b748
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 8 deletions.
3 changes: 2 additions & 1 deletion packages/cli/package.json
Expand Up @@ -81,7 +81,8 @@
"minimist": ">=1.2.3"
},
"dependencies": {
"@blockstack/stacks-transactions": "^0.6.0",
"@stacks/transactions": "^1.0.0",
"@stacks/network": "^1.0.0",
"ajv": "^4.11.5",
"bip32": "^2.0.4",
"bip39": "^3.0.2",
Expand Down
15 changes: 10 additions & 5 deletions packages/cli/src/cli.ts
Expand Up @@ -22,8 +22,7 @@ import {
estimateTransfer,
estimateContractDeploy,
estimateContractFunctionCall,
StacksMainnet,
StacksTestnet,
SignedTokenTransferOptions,
TokenTransferOptions,
ContractDeployOptions,
ContractCallOptions,
Expand All @@ -35,7 +34,13 @@ import {
validateContractCall,
PostConditionMode,
cvToString,
} from '@blockstack/stacks-transactions';
StacksTransaction
} from '@stacks/transactions';

import {
StacksMainnet,
StacksTestnet,
} from '@stacks/network';

const c32check = require('c32check');

Expand Down Expand Up @@ -556,7 +561,7 @@ async function sendTokens(network: CLINetworkAdapter, args: string[]) : Promise<
const txNetwork = network.isMainnet() ? new StacksMainnet() : new StacksTestnet();
txNetwork.coreApiUrl = network.blockstackAPIUrl;

const options: TokenTransferOptions = {
const options: SignedTokenTransferOptions = {
recipient: recipientAddress,
amount: tokenAmount,
senderKey: privateKey,
Expand All @@ -566,7 +571,7 @@ async function sendTokens(network: CLINetworkAdapter, args: string[]) : Promise<
network: txNetwork
}

const tx = await makeSTXTokenTransfer(options);
const tx: StacksTransaction = await makeSTXTokenTransfer(options);

if (estimateOnly) {
return estimateTransfer(tx, txNetwork).then((cost) => {
Expand Down
7 changes: 5 additions & 2 deletions packages/cli/src/utils.ts
Expand Up @@ -22,9 +22,12 @@ import {
trueCV,
falseCV,
standardPrincipalCV,
StacksNetwork,
TransactionVersion,
} from '@blockstack/stacks-transactions';
} from '@stacks/transactions';

import {
StacksNetwork,
} from '@stacks/network';

const ZoneFile = require('zone-file');

Expand Down

0 comments on commit 833b748

Please sign in to comment.