Skip to content
This repository was archived by the owner on Oct 6, 2021. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 1 addition & 6 deletions packages/client/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,7 @@ import {
fromWasmSync
} from '@oasislabs/service';
import { Deoxysii, encrypt, decrypt } from '@oasislabs/confidential';
import {
Web3Gateway,
EthereumCoder,
EthereumWallet as Wallet
} from '@oasislabs/ethereum';
import { Web3Gateway, EthereumWallet as Wallet } from '@oasislabs/ethereum';
import workspace from './workspace';

const oasis = {
Expand All @@ -35,7 +31,6 @@ const oasis = {
encrypt,
decrypt,
OasisCoder,
EthereumCoder,
header,
keccak256,
idl: {
Expand Down
2 changes: 1 addition & 1 deletion packages/ethereum/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,11 @@
]
},
"dependencies": {
"@ethersproject/wallet": "^5.0.0-beta.129",
"@oasislabs/common": "^1.0.0-rc.6",
"@oasislabs/service": "^1.0.0-rc.9",
"@oasislabs/test": "^1.0.0-rc.9",
"axios": "^0.18.0",
"ethers": "^4.0.27",
"eventemitter3": "^3.1.2",
"js-sha3": "^0.8.0",
"node-localstorage": "^1.3.1",
Expand Down
78 changes: 0 additions & 78 deletions packages/ethereum/src/coder.ts

This file was deleted.

6 changes: 3 additions & 3 deletions packages/ethereum/src/gateway/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ export class Web3Gateway implements OasisGateway {
data: bytes.toHex(request.data)
});
let tx = await this._inner.web3.provider.transactions!.create(txParams);
let rawTx = await this._inner.wallet!.sign(tx);
let rawTx = await this._inner.wallet!.signTransaction(tx);
let txHash = await this.eth.sendRawTransaction(rawTx);
let receipt = await this.eth.getTransactionReceipt(txHash);

Expand Down Expand Up @@ -129,7 +129,7 @@ export class Web3Gateway implements OasisGateway {
to: bytes.toHex(request.address!)
});
let tx = await this._inner.web3.provider.transactions!.create(txParams);
let rawTx = await this._inner.wallet!.sign(tx);
let rawTx = await this._inner.wallet!.signTransaction(tx);
let executionPayload = await this.oasis.invoke(rawTx);

let error = undefined;
Expand Down Expand Up @@ -235,6 +235,6 @@ type Web3GatewayInner = {
};

export interface Wallet {
sign(tx: Transaction): Promise<string>;
signTransaction(tx: Transaction): Promise<string>;
address: string;
}
7 changes: 7 additions & 0 deletions packages/ethereum/src/gateway/transaction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,13 @@ export class TransactionFactory {

if (!tx.value) {
tx.value = '0x00';
} else {
let value = tx.value.replace(/^0x/, '');
// ethers.js requires an even-length hex string.
if (value.length % 2 === 1) {
value = '0' + value;
}
tx.value = '0x' + value;
}

let promises: Promise<any>[] = [];
Expand Down
2 changes: 1 addition & 1 deletion packages/ethereum/src/gateway/web3/provider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ export default class Web3Provider {
const tx = await this.transactions!.create(
params[0] as UnpreparedTransaction
);
const rawTx = await this.wallet!.sign(tx);
const rawTx = await this.wallet!.signTransaction(tx);
return this.ws.request({
method: 'eth_sendRawTransaction',
params: [rawTx]
Expand Down
6 changes: 2 additions & 4 deletions packages/ethereum/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
import { EthereumCoder } from './coder';
import { Web3Gateway } from './gateway';
import { ethers } from 'ethers';
import { Wallet } from '@ethersproject/wallet';

const EthereumWallet = ethers.Wallet;
export { EthereumCoder, Web3Gateway, EthereumWallet };
export { Web3Gateway, Wallet as EthereumWallet };
9 changes: 0 additions & 9 deletions packages/ethereum/test/encoder.spec.ts

This file was deleted.

Loading