@0xcert/ethereum-generic-provider
Advanced tools
Comparing version 0.0.0-alpha8 to 0.0.0-alpha9
@@ -26,3 +26,3 @@ "use strict"; | ||
this.$status = MutationStatus.INITIALIZED; | ||
this.$id = normalize_address_1.normalizeAddress(id); | ||
this.$id = id; | ||
this.$provider = provider; | ||
@@ -109,13 +109,20 @@ } | ||
else if (!tx.to || tx.to === '0x0') { | ||
tx.to = yield this.getTransactionReceipt().then((r) => r.contractAddress); | ||
tx.to = yield this.getTransactionReceipt().then((r) => r ? r.contractAddress : null); | ||
} | ||
this.$senderId = normalize_address_1.normalizeAddress(tx.from); | ||
this.$receiverId = normalize_address_1.normalizeAddress(tx.to); | ||
this.$confirmations = yield this.getLastBlock().then((lastBlock) => lastBlock - parseInt(tx.blockNumber || lastBlock)); | ||
if (this.$confirmations >= this.$provider.requiredConfirmations) { | ||
this.$status = MutationStatus.COMPLETED; | ||
this.emit(scaffold_1.MutationEvent.COMPLETE, this); | ||
if (tx.to) { | ||
this.$senderId = normalize_address_1.normalizeAddress(tx.from); | ||
this.$receiverId = normalize_address_1.normalizeAddress(tx.to); | ||
this.$confirmations = yield this.getLastBlock() | ||
.then((lastBlock) => lastBlock - parseInt(tx.blockNumber || lastBlock)) | ||
.then((num) => num < 0 ? 0 : num); | ||
if (this.$confirmations >= this.$provider.requiredConfirmations) { | ||
this.$status = MutationStatus.COMPLETED; | ||
this.emit(scaffold_1.MutationEvent.COMPLETE, this); | ||
} | ||
else { | ||
this.emit(scaffold_1.MutationEvent.CONFIRM, this); | ||
this.$timer = setTimeout(this.loopUntilResolved.bind(this), 14000); | ||
} | ||
} | ||
else { | ||
this.emit(scaffold_1.MutationEvent.CONFIRM, this); | ||
this.$timer = setTimeout(this.loopUntilResolved.bind(this), 14000); | ||
@@ -122,0 +129,0 @@ } |
@@ -18,4 +18,4 @@ "use strict"; | ||
this.unsafeRecipientIds = options.unsafeRecipientIds || []; | ||
this.assetLedgerSource = options.assetLedgerSource || 'https://cdn.jsdelivr.net/gh/xpepermint/0xcert-contracts/asset-ledger.json', | ||
this.valueLedgerSource = options.valueLedgerSource || 'https://cdn.jsdelivr.net/gh/xpepermint/0xcert-contracts/value-ledger.json', | ||
this.assetLedgerSource = options.assetLedgerSource || 'https://docs.0xcert.org/xcert-mock.json', | ||
this.valueLedgerSource = options.valueLedgerSource || 'https://docs.0xcert.org/token-mock.json', | ||
this.signMethod = typeof options.signMethod !== 'undefined' ? options.signMethod : types_1.SignMethod.ETH_SIGN; | ||
@@ -22,0 +22,0 @@ this.requiredConfirmations = typeof options.requiredConfirmations !== 'undefined' ? options.requiredConfirmations : 1; |
@@ -49,6 +49,6 @@ "use strict"; | ||
ctx.is(mutation.id, transactionHash); | ||
ctx.is(mutation.senderId, coinbase.toLowerCase()); | ||
ctx.is(mutation.receiverId, bob.toLowerCase()); | ||
ctx.is(mutation.senderId, coinbase); | ||
ctx.is(mutation.receiverId, bob); | ||
})); | ||
exports.default = spec; | ||
//# sourceMappingURL=resolve-instance-method.test.js.map |
{ | ||
"files": { | ||
"packages/0xcert-ethereum-generic-provider/README.md": "22522c3dc727189e74e28372635710c1bdc9bfb2", | ||
"packages/0xcert-ethereum-generic-provider/nodemon.json": "82b893373db9861f1df4b55d8ea68a5d37b118de", | ||
"packages/0xcert-ethereum-generic-provider/package.json": "39793c27fc4475b5295554ca52c81dfe9ff1d273", | ||
"packages/0xcert-ethereum-generic-provider/src/core/errors.ts": "bf58b305f5c237a1fb7081e7a0d54301aa828586", | ||
"packages/0xcert-ethereum-generic-provider/src/core/mutation.ts": "fb9bd2f96438310100e23315f13e2e971fe1ec90", | ||
"packages/0xcert-ethereum-generic-provider/src/core/provider.ts": "8da42756fda64240757da518c50ee5baa8cb224e", | ||
"packages/0xcert-ethereum-generic-provider/src/core/types.ts": "28bb5c12297663a8a1dfc736f3c54d5e63574fd2", | ||
"packages/0xcert-ethereum-generic-provider/src/index.ts": "ff743edaa3c677305c0816a38fa1c7e49aaa0031", | ||
"packages/0xcert-ethereum-generic-provider/src/tests/core/mutation/resolve-instance-method.test.ts": "f7144a54c4ac9683ccf11db54d4e096e9fb83872", | ||
"packages/0xcert-ethereum-generic-provider/src/tests/core/provider/post-instance-method.test.ts": "083c4d7c89ba9bbe89bd3ddff62f10a27b932502", | ||
"packages/0xcert-ethereum-generic-provider/src/tests/index.test.ts": "8f3b7d1d01c857ac2d3231518a012242fc0607a5", | ||
"packages/0xcert-ethereum-generic-provider/tsconfig.json": "4aeac3c20e45b7e477e82012eb7788f7dbb11bf3", | ||
"common/config/rush/npm-shrinkwrap.json": "8f19ba9dbdefd16dc6af9aff055b174191c3e0b8" | ||
}, | ||
"files": {}, | ||
"arguments": "npx specron test " | ||
} |
{ | ||
"name": "@0xcert/ethereum-generic-provider", | ||
"version": "0.0.0-alpha8", | ||
"version": "0.0.0-alpha9", | ||
"description": "Basic implementation of communication provider for the Ethereum blockchain.", | ||
@@ -58,3 +58,3 @@ "main": "./dist/index.js", | ||
"devDependencies": { | ||
"@0xcert/ethereum-sandbox": "0.0.0-alpha8", | ||
"@0xcert/ethereum-sandbox": "0.0.0-alpha9", | ||
"@types/node": "^10.12.10", | ||
@@ -69,5 +69,5 @@ "@specron/cli": "^0.5.1", | ||
"dependencies": { | ||
"@0xcert/ethereum-utils": "0.0.0-alpha8", | ||
"@0xcert/scaffold": "0.0.0-alpha8" | ||
"@0xcert/ethereum-utils": "0.0.0-alpha9", | ||
"@0xcert/scaffold": "0.0.0-alpha9" | ||
} | ||
} |
@@ -34,3 +34,3 @@ import { EventEmitter } from 'events'; | ||
this.$id = normalizeAddress(id); | ||
this.$id = id; | ||
this.$provider = provider; | ||
@@ -183,15 +183,21 @@ } | ||
else if (!tx.to || tx.to === '0x0') { | ||
tx.to = await this.getTransactionReceipt().then((r) => r.contractAddress); | ||
tx.to = await this.getTransactionReceipt().then((r) => r ? r.contractAddress : null); | ||
} | ||
if (tx.to) { | ||
this.$senderId = normalizeAddress(tx.from); | ||
this.$receiverId = normalizeAddress(tx.to); | ||
this.$confirmations = await this.getLastBlock() | ||
.then((lastBlock) => lastBlock - parseInt(tx.blockNumber || lastBlock)) | ||
.then((num) => num < 0 ? 0 : num); // -1 when pending transaction is moved to the next block. | ||
this.$senderId = normalizeAddress(tx.from); | ||
this.$receiverId = normalizeAddress(tx.to); | ||
this.$confirmations = await this.getLastBlock().then((lastBlock) => lastBlock - parseInt(tx.blockNumber || lastBlock)); | ||
if (this.$confirmations >= this.$provider.requiredConfirmations) { | ||
this.$status = MutationStatus.COMPLETED; | ||
this.emit(MutationEvent.COMPLETE, this); | ||
if (this.$confirmations >= this.$provider.requiredConfirmations) { | ||
this.$status = MutationStatus.COMPLETED; | ||
this.emit(MutationEvent.COMPLETE, this); | ||
} | ||
else { | ||
this.emit(MutationEvent.CONFIRM, this); | ||
this.$timer = setTimeout(this.loopUntilResolved.bind(this), 14000); | ||
} | ||
} | ||
else { | ||
this.emit(MutationEvent.CONFIRM, this); | ||
this.$timer = setTimeout(this.loopUntilResolved.bind(this), 14000); | ||
@@ -198,0 +204,0 @@ } |
@@ -40,4 +40,4 @@ import { RpcResponse, SendOptions, SignMethod } from './types'; | ||
this.unsafeRecipientIds = options.unsafeRecipientIds || []; | ||
this.assetLedgerSource = options.assetLedgerSource || 'https://cdn.jsdelivr.net/gh/xpepermint/0xcert-contracts/asset-ledger.json', | ||
this.valueLedgerSource = options.valueLedgerSource || 'https://cdn.jsdelivr.net/gh/xpepermint/0xcert-contracts/value-ledger.json', | ||
this.assetLedgerSource = options.assetLedgerSource || 'https://docs.0xcert.org/xcert-mock.json', | ||
this.valueLedgerSource = options.valueLedgerSource || 'https://docs.0xcert.org/token-mock.json', | ||
this.signMethod = typeof options.signMethod !== 'undefined' ? options.signMethod : SignMethod.ETH_SIGN; | ||
@@ -44,0 +44,0 @@ this.requiredConfirmations = typeof options.requiredConfirmations !== 'undefined' ? options.requiredConfirmations : 1; |
@@ -57,6 +57,6 @@ import { Spec } from '@specron/spec'; | ||
ctx.is(mutation.id, transactionHash); | ||
ctx.is(mutation.senderId, coinbase.toLowerCase()); | ||
ctx.is(mutation.receiverId, bob.toLowerCase()); | ||
ctx.is(mutation.senderId, coinbase); | ||
ctx.is(mutation.receiverId, bob); | ||
}); | ||
export default spec; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
0
45964
+ Added@0xcert/ethereum-utils@0.0.0-alpha9(transitive)
+ Added@0xcert/scaffold@0.0.0-alpha9(transitive)
- Removed@0xcert/ethereum-utils@0.0.0-alpha8(transitive)
- Removed@0xcert/scaffold@0.0.0-alpha8(transitive)