mirror of
https://github.com/status-im/MyCrypto.git
synced 2025-01-10 02:55:41 +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 BN from 'bn.js';
|
||||||
import abi from 'ethereumjs-abi';
|
import abi from 'ethereumjs-abi';
|
||||||
import { toWei, Units } from './units';
|
import { toWei, Units } from './units';
|
||||||
|
import { toBuffer } from 'ethereumjs-util';
|
||||||
|
|
||||||
const TIME_BOUNTY_MIN = new BN('1');
|
const TIME_BOUNTY_MIN = new BN('1');
|
||||||
|
|
||||||
@ -60,7 +61,7 @@ export const calcEACTotalCost = (
|
|||||||
|
|
||||||
export const getScheduleData = (
|
export const getScheduleData = (
|
||||||
toAddress: string,
|
toAddress: string,
|
||||||
callData = '',
|
callData: string | Buffer = '',
|
||||||
callGas: BN | null,
|
callGas: BN | null,
|
||||||
callValue: BN | null,
|
callValue: BN | null,
|
||||||
windowSize: number | null,
|
windowSize: number | null,
|
||||||
@ -73,6 +74,10 @@ export const getScheduleData = (
|
|||||||
requiredDeposit = new BN(0);
|
requiredDeposit = new BN(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (typeof callData === 'string') {
|
||||||
|
callData = toBuffer(callData);
|
||||||
|
}
|
||||||
|
|
||||||
if (
|
if (
|
||||||
!callValue ||
|
!callValue ||
|
||||||
!callGas ||
|
!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' {
|
declare module 'ethereumjs-abi' {
|
||||||
import BN from 'bn.js';
|
import BN from 'bn.js';
|
||||||
type Values = (string | number | BN | Array<any>)[];
|
type Values = (string | number | boolean | BN | Buffer | Array<any>)[];
|
||||||
type Types = string[];
|
type Types = string[];
|
||||||
export function eventID(name: string, types: Types): Buffer;
|
export function eventID(name: string, types: Types): Buffer;
|
||||||
export function methodID(name: string, types: Types): Buffer;
|
export function methodID(name: string, types: Types): Buffer;
|
||||||
export function rawEncode(types: Types, values: Values): Buffer;
|
export function rawEncode(types: Types, values: Values): Buffer;
|
||||||
export function rawDecode(
|
export function rawDecode(types: Types, data: string | Buffer): (Values)[];
|
||||||
types: Types,
|
|
||||||
data: string | Buffer
|
|
||||||
): (Buffer | boolean | number | BN | string)[];
|
|
||||||
export function simpleEncode(method: string, ...values: Values): Buffer;
|
export function simpleEncode(method: string, ...values: Values): Buffer;
|
||||||
export function simpleDecode(
|
export function simpleDecode(method: string, data: string | Buffer): (Values)[];
|
||||||
method: string,
|
|
||||||
data: string | Buffer
|
|
||||||
): (Buffer | boolean | number | BN | string)[];
|
|
||||||
export function stringify(types: Types, values: Values): string;
|
export function stringify(types: Types, values: Values): string;
|
||||||
export function solidityPack(types: Types, values: Values): Buffer;
|
export function solidityPack(types: Types, values: Values): Buffer;
|
||||||
export function soliditySHA3(types: Types, values: Values): Buffer;
|
export function soliditySHA3(types: Types, values: Values): Buffer;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user