Skip to content

Commit

Permalink
Update FinalExecutionOutCome
Browse files Browse the repository at this point in the history
  • Loading branch information
bowenwang1996 committed Dec 20, 2019
1 parent 476d416 commit 2dbd5d6
Show file tree
Hide file tree
Showing 11 changed files with 44 additions and 265 deletions.
4 changes: 2 additions & 2 deletions lib/account.js

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

2 changes: 1 addition & 1 deletion lib/near.js

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

4 changes: 2 additions & 2 deletions lib/providers/index.d.ts

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

1 change: 0 additions & 1 deletion lib/providers/index.js

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

32 changes: 4 additions & 28 deletions lib/providers/provider.d.ts

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

114 changes: 13 additions & 101 deletions lib/providers/provider.js

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

4 changes: 2 additions & 2 deletions src.ts/account.ts
Original file line number Diff line number Diff line change
Expand Up @@ -114,12 +114,12 @@ export class Account {
}
}

const flatLogs = [result.transaction, ...result.receipts].reduce((acc, it) => acc.concat(it.outcome.logs), []);
const flatLogs = [result.transaction_outcome, ...result.receipts_outcome].reduce((acc, it) => acc.concat(it.outcome.logs), []);
this.printLogs(signedTx.transaction.receiverId, flatLogs);

if (typeof result.status === 'object' && typeof result.status.Failure === 'object') {
throw new TypedError(
`Transaction ${result.transaction.id} failed. ${result.status.Failure.error_message}`,
`Transaction ${result.transaction_outcome.id} failed. ${result.status.Failure.error_message}`,
result.status.Failure.error_type);
}
// TODO: if Tx is Unknown or Started.
Expand Down
2 changes: 1 addition & 1 deletion src.ts/near.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ export class Near {
console.warn('near.sendTokens is deprecated. Use `yourAccount.sendMoney` instead.');
const account = new Account(this.connection, originator);
const result = await account.sendMoney(receiver, amount);
return result.transaction.id;
return result.transaction_outcome.id;
}
}

Expand Down
3 changes: 1 addition & 2 deletions src.ts/providers/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

import { Provider, FinalExecutionOutcome, ExecutionOutcomeWithId, getTransactionLastResult, FinalExecutionStatusBasic, adaptTransactionResult } from './provider';
import { Provider, FinalExecutionOutcome, ExecutionOutcomeWithId, getTransactionLastResult, FinalExecutionStatusBasic } from './provider';
import { JsonRpcProvider, TypedError } from './json-rpc-provider';

export {
Expand All @@ -9,6 +9,5 @@ export {
ExecutionOutcomeWithId,
FinalExecutionStatusBasic,
getTransactionLastResult,
adaptTransactionResult,
TypedError
};
4 changes: 2 additions & 2 deletions src.ts/providers/json-rpc-provider.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
'use strict';

import {
Provider, FinalExecutionOutcome, NodeStatusResult, BlockId,
BlockResult, ChunkId, ChunkResult, adaptTransactionResult
Provider, FinalExecutionOutcome, NodeStatusResult, BlockId,
BlockResult, ChunkId, ChunkResult, adaptTransactionResult
} from './provider';
import { Network } from '../utils/network';
import { ConnectionInfo, fetchJson } from '../utils/web';
Expand Down
Loading

0 comments on commit 2dbd5d6

Please sign in to comment.