mirror of
https://github.com/status-im/MyCrypto.git
synced 2025-01-09 18:45:38 +00:00
[FIX] Fix data serialization.
This commit is contained in:
parent
a79b1d72e9
commit
cc84e5fc4e
@ -1,6 +1,7 @@
|
||||
import BN from 'bn.js';
|
||||
import abi from 'ethereumjs-abi';
|
||||
import { toWei, Units } from './units';
|
||||
import { toBuffer } from 'ethereumjs-util';
|
||||
|
||||
const TIME_BOUNTY_MIN = new BN('1');
|
||||
|
||||
@ -60,7 +61,7 @@ export const calcEACTotalCost = (
|
||||
|
||||
export const getScheduleData = (
|
||||
toAddress: string,
|
||||
callData = '',
|
||||
callData: string | Buffer = '',
|
||||
callGas: BN | null,
|
||||
callValue: BN | null,
|
||||
windowSize: number | null,
|
||||
@ -73,6 +74,10 @@ export const getScheduleData = (
|
||||
requiredDeposit = new BN(0);
|
||||
}
|
||||
|
||||
if (typeof callData === 'string') {
|
||||
callData = toBuffer(callData);
|
||||
}
|
||||
|
||||
if (
|
||||
!callValue ||
|
||||
!callGas ||
|
||||
|
12
common/typescript/ethereumjs-abi.d.ts
vendored
12
common/typescript/ethereumjs-abi.d.ts
vendored
@ -1,19 +1,13 @@
|
||||
declare module 'ethereumjs-abi' {
|
||||
import BN from 'bn.js';
|
||||
type Values = (string | number | BN | Array<any>)[];
|
||||
type Values = (string | number | boolean | BN | Buffer | Array<any>)[];
|
||||
type Types = string[];
|
||||
export function eventID(name: string, types: Types): Buffer;
|
||||
export function methodID(name: string, types: Types): Buffer;
|
||||
export function rawEncode(types: Types, values: Values): Buffer;
|
||||
export function rawDecode(
|
||||
types: Types,
|
||||
data: string | Buffer
|
||||
): (Buffer | boolean | number | BN | string)[];
|
||||
export function rawDecode(types: Types, data: string | Buffer): (Values)[];
|
||||
export function simpleEncode(method: string, ...values: Values): Buffer;
|
||||
export function simpleDecode(
|
||||
method: string,
|
||||
data: string | Buffer
|
||||
): (Buffer | boolean | number | BN | string)[];
|
||||
export function simpleDecode(method: string, data: string | Buffer): (Values)[];
|
||||
export function stringify(types: Types, values: Values): string;
|
||||
export function solidityPack(types: Types, values: Values): Buffer;
|
||||
export function soliditySHA3(types: Types, values: Values): Buffer;
|
||||
|
Loading…
x
Reference in New Issue
Block a user