@btc-vision/btc-runtime 1.4.4 → 1.4.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -2,13 +2,11 @@ import { i128, u128, u256 } from '@btc-vision/as-bignum/assembly';
|
|
|
2
2
|
import { TransactionInput, TransactionOutput } from '../env/classes/UTXO';
|
|
3
3
|
import { AddressMap } from '../generic/AddressMap';
|
|
4
4
|
import { Selector } from '../math/abi';
|
|
5
|
-
import { i256 } from '../math/i256';
|
|
6
5
|
import { Address } from '../types/Address';
|
|
7
6
|
import { Revert } from '../types/Revert';
|
|
8
7
|
import {
|
|
9
8
|
ADDRESS_BYTE_LENGTH,
|
|
10
9
|
I128_BYTE_LENGTH,
|
|
11
|
-
I256_BYTE_LENGTH,
|
|
12
10
|
I64_BYTE_LENGTH,
|
|
13
11
|
U128_BYTE_LENGTH,
|
|
14
12
|
U16_BYTE_LENGTH,
|
|
@@ -16,7 +14,7 @@ import {
|
|
|
16
14
|
U32_BYTE_LENGTH,
|
|
17
15
|
U64_BYTE_LENGTH,
|
|
18
16
|
U8_BYTE_LENGTH,
|
|
19
|
-
} from '../utils
|
|
17
|
+
} from '../utils';
|
|
20
18
|
|
|
21
19
|
@final
|
|
22
20
|
export class BytesReader {
|
|
@@ -187,14 +185,6 @@ export class BytesReader {
|
|
|
187
185
|
return result;
|
|
188
186
|
}
|
|
189
187
|
|
|
190
|
-
public readI256(): i256 {
|
|
191
|
-
this.verifyEnd(this.currentOffset + I256_BYTE_LENGTH);
|
|
192
|
-
|
|
193
|
-
const next32Bytes: u8[] = this.readBytesBE(I256_BYTE_LENGTH);
|
|
194
|
-
|
|
195
|
-
return i256.fromBytesBE(next32Bytes);
|
|
196
|
-
}
|
|
197
|
-
|
|
198
188
|
public readTuple(): u256[] {
|
|
199
189
|
const length = this.readU32();
|
|
200
190
|
const result: u256[] = new Array<u256>(length);
|
|
@@ -2,20 +2,18 @@ import { i128, u128, u256 } from '@btc-vision/as-bignum/assembly';
|
|
|
2
2
|
import { ArrayBuffer } from 'arraybuffer';
|
|
3
3
|
import { AddressMap } from '../generic/AddressMap';
|
|
4
4
|
import { Selector } from '../math/abi';
|
|
5
|
-
import { i256 } from '../math/i256';
|
|
6
5
|
import { Address } from '../types/Address';
|
|
7
6
|
import { Revert } from '../types/Revert';
|
|
8
7
|
import {
|
|
9
8
|
ADDRESS_BYTE_LENGTH,
|
|
10
9
|
I128_BYTE_LENGTH,
|
|
11
|
-
I256_BYTE_LENGTH,
|
|
12
10
|
U128_BYTE_LENGTH,
|
|
13
11
|
U16_BYTE_LENGTH,
|
|
14
12
|
U256_BYTE_LENGTH,
|
|
15
13
|
U32_BYTE_LENGTH,
|
|
16
14
|
U64_BYTE_LENGTH,
|
|
17
15
|
U8_BYTE_LENGTH,
|
|
18
|
-
} from '../utils
|
|
16
|
+
} from '../utils';
|
|
19
17
|
import { BytesReader } from './BytesReader';
|
|
20
18
|
|
|
21
19
|
@final
|
|
@@ -76,15 +74,6 @@ export class BytesWriter {
|
|
|
76
74
|
this.writeU8(value ? 1 : 0);
|
|
77
75
|
}
|
|
78
76
|
|
|
79
|
-
public writeI256(value: i256): void {
|
|
80
|
-
this.allocSafe(I256_BYTE_LENGTH);
|
|
81
|
-
|
|
82
|
-
const bytes = value.toUint8Array(true);
|
|
83
|
-
for (let i: i32 = 0; i < I256_BYTE_LENGTH; i++) {
|
|
84
|
-
this.writeU8(bytes[i] || 0);
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
|
|
88
77
|
public writeU8At(value: u8, offset: u32): void {
|
|
89
78
|
this.buffer.setUint8(offset, value);
|
|
90
79
|
}
|
package/runtime/utils/lengths.ts
CHANGED
|
@@ -8,7 +8,6 @@ export const U32_BYTE_LENGTH: i32 = 4;
|
|
|
8
8
|
export const U16_BYTE_LENGTH: i32 = 2;
|
|
9
9
|
export const U8_BYTE_LENGTH: i32 = 1;
|
|
10
10
|
|
|
11
|
-
export const I256_BYTE_LENGTH: i32 = 32;
|
|
12
11
|
export const I128_BYTE_LENGTH: i32 = 16;
|
|
13
12
|
export const I64_BYTE_LENGTH: i32 = 8;
|
|
14
13
|
export const I32_BYTE_LENGTH: i32 = 4;
|