Skip to content

Commit

Permalink
feat: fo-479: add a send to address helper to run, update dist
Browse files Browse the repository at this point in the history
  • Loading branch information
okovalov committed Oct 8, 2021
1 parent 6889061 commit 8bc65b0
Show file tree
Hide file tree
Showing 11 changed files with 946 additions and 19 deletions.
6 changes: 6 additions & 0 deletions dist/api/network/types.d.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
export interface ResultError {
message: string;
code?: number;
}
export interface DataResult {
response?: any;
Expand Down Expand Up @@ -247,6 +248,11 @@ export interface SubmitEvmTxResult extends NetworkAxiosDataResult {
export interface EthMainRpcResponse {
id: string;
jsonrpc: string;
error?: {
code: number;
message: string;
data?: any;
};
}
export interface EthProtocolRpcResponse extends EthMainRpcResponse {
result: string;
Expand Down
1 change: 1 addition & 0 deletions dist/evm/rpc.integration.negative.spec.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
import '@testing-library/jest-dom/extend-expect';
857 changes: 857 additions & 0 deletions dist/evm/rpc.integration.negative.spec.js

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions dist/evm/rpc.integration.negative.spec.js.map

Large diffs are not rendered by default.

8 changes: 1 addition & 7 deletions dist/evm/rpc.integration.spec.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/evm/rpc.integration.spec.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/integration.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/integration.js.map

Large diffs are not rendered by default.

42 changes: 38 additions & 4 deletions dist/run.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/run.js.map

Large diffs are not rendered by default.

42 changes: 38 additions & 4 deletions src/run.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,8 @@ const getFraBalance = async () => {

console.log('\n');

console.log('balance IS', balance);
console.log('balanceNew IS', balanceNew);
console.log('balance from restored from pkey IS', balance);
console.log('balance from restored using mnemonic IS', balanceNew);
console.log('\n');
console.log('\n');
};
Expand Down Expand Up @@ -236,6 +236,39 @@ const createNewKeypair = async () => {
console.log('new wallet info', walletInfo);
};

/**
* Send fra to a single address
*/
const transferFraToSingleAddress = async () => {
const pkey = PKEY_MINE;

// const toPkeyMine2 = PKEY_MINE2;
const destAddress = 'fra1a3xvplthykqercmpec7d27kl0lj55pax5ua77fztwx9kq58a3hxsxu378y';
const password = '123';

const walletInfo = await Keypair.restoreFromPrivateKey(pkey, password);
// const toWalletInfo = await Keypair.restoreFromPrivateKey(toPkeyMine2, password);
const toWalletInfo = await Keypair.getAddressPublicAndKey(destAddress);

const fraCode = await Asset.getFraAssetCode();

const assetCode = fraCode;

const assetBlindRules: Asset.AssetBlindRules = { isTypeBlind: false, isAmountBlind: false };

const transactionBuilder = await Transaction.sendToAddress(
walletInfo,
toWalletInfo.address,
'0.01',
assetCode,
assetBlindRules,
);

const resultHandle = await Transaction.submitTransaction(transactionBuilder);

console.log('send fra result handle!!', resultHandle);
};

/**
* Send fra to a single recepient
*/
Expand Down Expand Up @@ -1110,15 +1143,16 @@ const ethProtocol = async () => {
console.log(`🚀 ~ file: run.ts ~ line 1154 ~ ${methodName} ~ result`, result);
};

getFraBalance();
// getFraBalance();
// transferFraToSingleAddress();
// getCustomAssetBalance();
// defineCustomAsset();
// issueCustomAsset();
// getStateCommitment();
// getValidatorList();
// getDelegateInfo();
// getTransferBuilderOperation();
// createNewKeypair();
createNewKeypair();
// transferFraToSingleRecepient();
// transferFraToMultipleRecepients();
// transferCustomAssetToSingleRecepient();
Expand Down

0 comments on commit 8bc65b0

Please sign in to comment.