repo
stringlengths
7
64
file_url
stringlengths
81
338
file_path
stringlengths
5
257
content
stringlengths
0
32.8k
language
stringclasses
1 value
license
stringclasses
7 values
commit_sha
stringlengths
40
40
retrieved_at
stringdate
2026-01-04 15:25:31
2026-01-05 01:50:38
truncated
bool
2 classes
FuelLabs/fuels-ts
https://github.com/FuelLabs/fuels-ts/blob/9a7b69726b3181a0c2c8f0dd2da83e86774ed1b2/packages/merkle/src/sparse/utils.ts
packages/merkle/src/sparse/utils.ts
export const ZERO = '0x0000000000000000000000000000000000000000000000000000000000000000'; export const EMPTY = '0xe3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855'; export const MAX_HEIGHT = 256; export interface MapStore { [key: string]: string; } /** * Gets the bit at an offset from the most sign...
typescript
Apache-2.0
9a7b69726b3181a0c2c8f0dd2da83e86774ed1b2
2026-01-04T15:46:46.933446Z
false
FuelLabs/fuels-ts
https://github.com/FuelLabs/fuels-ts/blob/9a7b69726b3181a0c2c8f0dd2da83e86774ed1b2/packages/merkle/src/sparse/sparseMerkleTree.ts
packages/merkle/src/sparse/sparseMerkleTree.ts
/// @dev The Fuel testing Merkle trees. /// A set of useful helper methods for testing and deploying Merkle trees. import { hash } from '@fuel-ts/hasher'; import { compactProof } from './proofs'; import { isLeaf, hashLeaf, hashNode, parseLeaf, parseNode } from './treeHasher'; import type SparseCompactMerkleProof from ...
typescript
Apache-2.0
9a7b69726b3181a0c2c8f0dd2da83e86774ed1b2
2026-01-04T15:46:46.933446Z
false
FuelLabs/fuels-ts
https://github.com/FuelLabs/fuels-ts/blob/9a7b69726b3181a0c2c8f0dd2da83e86774ed1b2/packages/merkle/src/sparse/treeHasher.ts
packages/merkle/src/sparse/treeHasher.ts
import { hash } from '@fuel-ts/hasher'; export const leafPrefix = '0x00'; export const nodePrefix = '0x01'; /** * Slice off the '0x' on each argument to simulate abi.encode * prefix + key + hash(data) */ export function hashLeaf(key: string, data: string): [string, string] { const value = '0x00'.concat(key.slice...
typescript
Apache-2.0
9a7b69726b3181a0c2c8f0dd2da83e86774ed1b2
2026-01-04T15:46:46.933446Z
false
FuelLabs/fuels-ts
https://github.com/FuelLabs/fuels-ts/blob/9a7b69726b3181a0c2c8f0dd2da83e86774ed1b2/packages/merkle/src/sparse/index.ts
packages/merkle/src/sparse/index.ts
export { SparseMerkleTree } from './sparseMerkleTree';
typescript
Apache-2.0
9a7b69726b3181a0c2c8f0dd2da83e86774ed1b2
2026-01-04T15:46:46.933446Z
false
FuelLabs/fuels-ts
https://github.com/FuelLabs/fuels-ts/blob/9a7b69726b3181a0c2c8f0dd2da83e86774ed1b2/packages/merkle/src/sparse/proofs.ts
packages/merkle/src/sparse/proofs.ts
import { hash } from '@fuel-ts/hasher'; import { hashLeaf, hashNode, parseLeaf } from './treeHasher'; import SparseCompactMerkleProof from './types/sparseCompactMerkleProof'; import SparseMerkleProof from './types/sparseMerkleProof'; import { getBitAtFromMSB, ZERO } from './utils'; /** * Verify a merkle proof */ ex...
typescript
Apache-2.0
9a7b69726b3181a0c2c8f0dd2da83e86774ed1b2
2026-01-04T15:46:46.933446Z
false
FuelLabs/fuels-ts
https://github.com/FuelLabs/fuels-ts/blob/9a7b69726b3181a0c2c8f0dd2da83e86774ed1b2/packages/merkle/src/sparse/types/sparseMerkleSolidityNode.ts
packages/merkle/src/sparse/types/sparseMerkleSolidityNode.ts
import { ZERO } from '../utils'; class SparseMerkleSolidityNode { digest: string; prefix: string; leftChildPtr: string; rightChildPtr: string; key: string; leafData: string; constructor(rawData: string) { // Not interested in digest or children of Sibling / NonMembershipLeaf this.digest = ZERO; ...
typescript
Apache-2.0
9a7b69726b3181a0c2c8f0dd2da83e86774ed1b2
2026-01-04T15:46:46.933446Z
false
FuelLabs/fuels-ts
https://github.com/FuelLabs/fuels-ts/blob/9a7b69726b3181a0c2c8f0dd2da83e86774ed1b2/packages/merkle/src/sparse/types/sparseCompactMerkleBranch.ts
packages/merkle/src/sparse/types/sparseCompactMerkleBranch.ts
import type SparseCompactMerkleSolidityProof from './sparseCompactMerkleSolidityProof'; class SparseCompactMerkleBranch { proof: SparseCompactMerkleSolidityProof; key: string; value: string; constructor(proof: SparseCompactMerkleSolidityProof, key: string, value: string) { this.proof = proof; this.key...
typescript
Apache-2.0
9a7b69726b3181a0c2c8f0dd2da83e86774ed1b2
2026-01-04T15:46:46.933446Z
false
FuelLabs/fuels-ts
https://github.com/FuelLabs/fuels-ts/blob/9a7b69726b3181a0c2c8f0dd2da83e86774ed1b2/packages/merkle/src/sparse/types/sparseMerkleProof.ts
packages/merkle/src/sparse/types/sparseMerkleProof.ts
// Sparse Merkle proof class SparseMerkleProof { SideNodes: string[]; NonMembershipLeafData: string; SiblingData: string; constructor(sideNodes: string[], NonMembershipLeafData: string, SiblingData: string) { this.SideNodes = sideNodes; this.NonMembershipLeafData = NonMembershipLeafData; this.Sibli...
typescript
Apache-2.0
9a7b69726b3181a0c2c8f0dd2da83e86774ed1b2
2026-01-04T15:46:46.933446Z
false
FuelLabs/fuels-ts
https://github.com/FuelLabs/fuels-ts/blob/9a7b69726b3181a0c2c8f0dd2da83e86774ed1b2/packages/merkle/src/sparse/types/sparseCompactMerkleSolidityProof.ts
packages/merkle/src/sparse/types/sparseCompactMerkleSolidityProof.ts
import type SparseMerkleSolidityNode from './sparseMerkleSolidityNode'; class SparseCompactMerkleSolidityProof { SideNodes: string[]; NonMembershipLeaf: SparseMerkleSolidityNode; BitMask: number[]; NumSideNodes: number; Sibling: SparseMerkleSolidityNode; constructor( SideNodes: string[], NonMember...
typescript
Apache-2.0
9a7b69726b3181a0c2c8f0dd2da83e86774ed1b2
2026-01-04T15:46:46.933446Z
false
FuelLabs/fuels-ts
https://github.com/FuelLabs/fuels-ts/blob/9a7b69726b3181a0c2c8f0dd2da83e86774ed1b2/packages/merkle/src/sparse/types/sparseCompactMerkleProof.ts
packages/merkle/src/sparse/types/sparseCompactMerkleProof.ts
class SparseCompactMerkleProof { SideNodes: string[]; NonMembershipLeafData: string; BitMask: number[]; NumSideNodes: number; SiblingData: string; constructor( SideNodes: string[], NonMembershipLeafData: string, Bitmask: number[], NumSideNodes: number, SiblingData: string ) { this...
typescript
Apache-2.0
9a7b69726b3181a0c2c8f0dd2da83e86774ed1b2
2026-01-04T15:46:46.933446Z
false
FuelLabs/fuels-ts
https://github.com/FuelLabs/fuels-ts/blob/9a7b69726b3181a0c2c8f0dd2da83e86774ed1b2/packages/merkle/src/common/common.ts
packages/merkle/src/common/common.ts
/// @dev The Fuel testing Merkle trees. /// A set of useful helper methods for testing and deploying Merkle trees. export const EMPTY = '0xe3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855'; export const ZERO = '0x0000000000000000000000000000000000000000000000000000000000000000'; export const MAX_HEIGHT...
typescript
Apache-2.0
9a7b69726b3181a0c2c8f0dd2da83e86774ed1b2
2026-01-04T15:46:46.933446Z
false
FuelLabs/fuels-ts
https://github.com/FuelLabs/fuels-ts/blob/9a7b69726b3181a0c2c8f0dd2da83e86774ed1b2/packages/merkle/src/common/index.ts
packages/merkle/src/common/index.ts
export * from './common';
typescript
Apache-2.0
9a7b69726b3181a0c2c8f0dd2da83e86774ed1b2
2026-01-04T15:46:46.933446Z
false
FuelLabs/fuels-ts
https://github.com/FuelLabs/fuels-ts/blob/9a7b69726b3181a0c2c8f0dd2da83e86774ed1b2/packages/merkle/src/sum/sumMerkleTree.ts
packages/merkle/src/sum/sumMerkleTree.ts
/// @dev The Fuel testing Merkle trees. /// A set of useful helper methods for testing and deploying Merkle trees. import { hash } from '@fuel-ts/hasher'; import { bn, toHex } from '@fuel-ts/math'; import Node from './types/node'; import Proof from './types/proof'; /** * Slice off the '0x' on each argument to simula...
typescript
Apache-2.0
9a7b69726b3181a0c2c8f0dd2da83e86774ed1b2
2026-01-04T15:46:46.933446Z
false
FuelLabs/fuels-ts
https://github.com/FuelLabs/fuels-ts/blob/9a7b69726b3181a0c2c8f0dd2da83e86774ed1b2/packages/merkle/src/sum/sumMerkleTree.test.ts
packages/merkle/src/sum/sumMerkleTree.test.ts
import { toHex } from '@fuel-ts/math'; import { calcRoot, constructTree, getProof } from './sumMerkleTree'; import Proof from './types/proof'; /** * @group node */ describe('Sum Merkle Tree', () => { const size = 100; const sumAfterLeaves = toHex(((size - 1) * size) / 2); let data: string[] = []; let values...
typescript
Apache-2.0
9a7b69726b3181a0c2c8f0dd2da83e86774ed1b2
2026-01-04T15:46:46.933446Z
false
FuelLabs/fuels-ts
https://github.com/FuelLabs/fuels-ts/blob/9a7b69726b3181a0c2c8f0dd2da83e86774ed1b2/packages/merkle/src/sum/index.ts
packages/merkle/src/sum/index.ts
export * from './sumMerkleTree';
typescript
Apache-2.0
9a7b69726b3181a0c2c8f0dd2da83e86774ed1b2
2026-01-04T15:46:46.933446Z
false
FuelLabs/fuels-ts
https://github.com/FuelLabs/fuels-ts/blob/9a7b69726b3181a0c2c8f0dd2da83e86774ed1b2/packages/merkle/src/sum/types/proof.ts
packages/merkle/src/sum/types/proof.ts
// Sum Merkle proof class Proof { sideNodes: string[]; nodeSums: string[]; constructor(sideNodes: string[], sums: string[]) { this.sideNodes = sideNodes; this.nodeSums = sums; } } export default Proof;
typescript
Apache-2.0
9a7b69726b3181a0c2c8f0dd2da83e86774ed1b2
2026-01-04T15:46:46.933446Z
false
FuelLabs/fuels-ts
https://github.com/FuelLabs/fuels-ts/blob/9a7b69726b3181a0c2c8f0dd2da83e86774ed1b2/packages/merkle/src/sum/types/node.ts
packages/merkle/src/sum/types/node.ts
class Node { left: number; right: number; parent: number; hash: string; data: string; sum: string; index: number; constructor( left: number, right: number, parent: number, hash: string, sum: string, data: string, index: number = 0 ) { this.left = left; this.right =...
typescript
Apache-2.0
9a7b69726b3181a0c2c8f0dd2da83e86774ed1b2
2026-01-04T15:46:46.933446Z
false
FuelLabs/fuels-ts
https://github.com/FuelLabs/fuels-ts/blob/9a7b69726b3181a0c2c8f0dd2da83e86774ed1b2/packages/merkle/src/binary/binaryMerkleTree.test.ts
packages/merkle/src/binary/binaryMerkleTree.test.ts
import { toHex } from '@fuel-ts/math'; import { calcRoot, constructTree, getProof } from './binaryMerkleTree'; import type Node from './types/node'; /** * @group node */ describe('Binary Merkle Tree', () => { const rootAfterLeaves = '0x9e59abcd7c89011ba919f9141624acb32b4cc31c24e76c6d4f64b25093ef366c'; const siz...
typescript
Apache-2.0
9a7b69726b3181a0c2c8f0dd2da83e86774ed1b2
2026-01-04T15:46:46.933446Z
false
FuelLabs/fuels-ts
https://github.com/FuelLabs/fuels-ts/blob/9a7b69726b3181a0c2c8f0dd2da83e86774ed1b2/packages/merkle/src/binary/binaryMerkleTree.ts
packages/merkle/src/binary/binaryMerkleTree.ts
// A set of useful helper methods for testing binary Merkle trees. import { hash } from '@fuel-ts/hasher'; import { EMPTY } from '../common'; import Node from './types/node'; /** * Slice off the '0x' on each argument to simulate abi.encodePacked */ export function hashLeaf(data: string): string { return hash('0x...
typescript
Apache-2.0
9a7b69726b3181a0c2c8f0dd2da83e86774ed1b2
2026-01-04T15:46:46.933446Z
false
FuelLabs/fuels-ts
https://github.com/FuelLabs/fuels-ts/blob/9a7b69726b3181a0c2c8f0dd2da83e86774ed1b2/packages/merkle/src/binary/index.ts
packages/merkle/src/binary/index.ts
export * from './binaryMerkleTree';
typescript
Apache-2.0
9a7b69726b3181a0c2c8f0dd2da83e86774ed1b2
2026-01-04T15:46:46.933446Z
false
FuelLabs/fuels-ts
https://github.com/FuelLabs/fuels-ts/blob/9a7b69726b3181a0c2c8f0dd2da83e86774ed1b2/packages/merkle/src/binary/types/branch.ts
packages/merkle/src/binary/types/branch.ts
class BinaryMerkleBranch { proof: string[]; key: string; value: string; constructor(proof: string[], key: string, value: string) { this.proof = proof; this.key = key; this.value = value; } } export default BinaryMerkleBranch;
typescript
Apache-2.0
9a7b69726b3181a0c2c8f0dd2da83e86774ed1b2
2026-01-04T15:46:46.933446Z
false
FuelLabs/fuels-ts
https://github.com/FuelLabs/fuels-ts/blob/9a7b69726b3181a0c2c8f0dd2da83e86774ed1b2/packages/merkle/src/binary/types/node.ts
packages/merkle/src/binary/types/node.ts
class Node { left: number; right: number; parent: number; hash: string; data: string; index: number; constructor( left: number, right: number, parent: number, hash: string, data: string, index: number = 0 ) { this.left = left; this.right = right; this.parent = parent...
typescript
Apache-2.0
9a7b69726b3181a0c2c8f0dd2da83e86774ed1b2
2026-01-04T15:46:46.933446Z
false
FuelLabs/fuels-ts
https://github.com/FuelLabs/fuels-ts/blob/9a7b69726b3181a0c2c8f0dd2da83e86774ed1b2/packages/utils/tsup.config.ts
packages/utils/tsup.config.ts
import { tsupDefaults } from '@internal/tsup'; import type { Options } from 'tsup'; const configs: Options = { ...tsupDefaults, entry: { index: 'src/index.ts', 'test-utils': 'src/test-utils.ts', 'cli-utils': 'src/cli-utils.ts', }, }; export default configs;
typescript
Apache-2.0
9a7b69726b3181a0c2c8f0dd2da83e86774ed1b2
2026-01-04T15:46:46.933446Z
false
FuelLabs/fuels-ts
https://github.com/FuelLabs/fuels-ts/blob/9a7b69726b3181a0c2c8f0dd2da83e86774ed1b2/packages/utils/src/test-util.test.ts
packages/utils/src/test-util.test.ts
import * as indexMod from './test-utils'; /** * @group node */ describe('index.js', () => { test('should export all test utilities', () => { expect(indexMod.getForcProject).toBeTruthy(); }); });
typescript
Apache-2.0
9a7b69726b3181a0c2c8f0dd2da83e86774ed1b2
2026-01-04T15:46:46.933446Z
false
FuelLabs/fuels-ts
https://github.com/FuelLabs/fuels-ts/blob/9a7b69726b3181a0c2c8f0dd2da83e86774ed1b2/packages/utils/src/index.test.ts
packages/utils/src/index.test.ts
import * as indexMod from '.'; /** * @group node * @group browser */ describe('index.js', () => { test('should export all utilities', () => { expect(indexMod.normalizeString).toBeTruthy(); expect(indexMod.chunkAndPadBytes).toBeTruthy(); expect(indexMod.concatBytes).toBeTruthy(); expect(indexMod.co...
typescript
Apache-2.0
9a7b69726b3181a0c2c8f0dd2da83e86774ed1b2
2026-01-04T15:46:46.933446Z
false
FuelLabs/fuels-ts
https://github.com/FuelLabs/fuels-ts/blob/9a7b69726b3181a0c2c8f0dd2da83e86774ed1b2/packages/utils/src/cli-utils.ts
packages/utils/src/cli-utils.ts
export * from './cli-utils/tryFindBinaries';
typescript
Apache-2.0
9a7b69726b3181a0c2c8f0dd2da83e86774ed1b2
2026-01-04T15:46:46.933446Z
false
FuelLabs/fuels-ts
https://github.com/FuelLabs/fuels-ts/blob/9a7b69726b3181a0c2c8f0dd2da83e86774ed1b2/packages/utils/src/test-utils.ts
packages/utils/src/test-utils.ts
export * from './test-utils/getForcProject'; export * from './test-utils/expectToBeInRange'; export * from './test-utils/constants'; export * from './test-utils/wait-until-unreachable'; export * from './test-utils/vitest.matchers';
typescript
Apache-2.0
9a7b69726b3181a0c2c8f0dd2da83e86774ed1b2
2026-01-04T15:46:46.933446Z
false
FuelLabs/fuels-ts
https://github.com/FuelLabs/fuels-ts/blob/9a7b69726b3181a0c2c8f0dd2da83e86774ed1b2/packages/utils/src/index.ts
packages/utils/src/index.ts
export * from './utils/capitalizeString'; export * from './utils/chunkAndPadBytes'; export * from './utils/concat'; export * from './utils/arrayify'; export * from './utils/hexlify'; export * from './utils/normalizeString'; export * from './utils/date-time'; export * from './utils/types'; export * from './utils/sleep';...
typescript
Apache-2.0
9a7b69726b3181a0c2c8f0dd2da83e86774ed1b2
2026-01-04T15:46:46.933446Z
false
FuelLabs/fuels-ts
https://github.com/FuelLabs/fuels-ts/blob/9a7b69726b3181a0c2c8f0dd2da83e86774ed1b2/packages/utils/src/utils/toUtf8String.ts
packages/utils/src/utils/toUtf8String.ts
import { arrayify } from './arrayify'; import type { BytesLike } from './arrayify'; /** * These errors are logged when decoding a UTF-8 string fails. * * `"UNEXPECTED_CONTINUE"` - a continuation byte was present where there * was nothing to continue. * * `"BAD_PREFIX"` - an invalid (non-continuation) byte to...
typescript
Apache-2.0
9a7b69726b3181a0c2c8f0dd2da83e86774ed1b2
2026-01-04T15:46:46.933446Z
false
FuelLabs/fuels-ts
https://github.com/FuelLabs/fuels-ts/blob/9a7b69726b3181a0c2c8f0dd2da83e86774ed1b2/packages/utils/src/utils/date-time.test.ts
packages/utils/src/utils/date-time.test.ts
import { DateTime } from './date-time'; const now = { tai64: '4611686020108779339', unixSeconds: 1681391398, unixMilliseconds: 1681391398000, isoString: '2023-04-13T13:09:58.000Z', }; const nowPlusOneSecond = { tai64: '4611686020108779340', unixSeconds: 1681391399, unixMilliseconds: 1681391399000, iso...
typescript
Apache-2.0
9a7b69726b3181a0c2c8f0dd2da83e86774ed1b2
2026-01-04T15:46:46.933446Z
false
FuelLabs/fuels-ts
https://github.com/FuelLabs/fuels-ts/blob/9a7b69726b3181a0c2c8f0dd2da83e86774ed1b2/packages/utils/src/utils/arrayify.test.ts
packages/utils/src/utils/arrayify.test.ts
import { FuelError, ErrorCode } from '@fuel-ts/errors'; import { arrayify } from './arrayify'; import type { BytesLike } from './arrayify'; /** * @group node * @group browser */ describe('arrayify', () => { it('returns Uint8Array from Uint8Array', () => { expect(arrayify(new Uint8Array([0, 1, 2, 3]))).toEqua...
typescript
Apache-2.0
9a7b69726b3181a0c2c8f0dd2da83e86774ed1b2
2026-01-04T15:46:46.933446Z
false
FuelLabs/fuels-ts
https://github.com/FuelLabs/fuels-ts/blob/9a7b69726b3181a0c2c8f0dd2da83e86774ed1b2/packages/utils/src/utils/capitalizeString.ts
packages/utils/src/utils/capitalizeString.ts
export const capitalizeString = (str: string) => { if (!str.length) { return str; } return str[0].toUpperCase() + str.slice(1); };
typescript
Apache-2.0
9a7b69726b3181a0c2c8f0dd2da83e86774ed1b2
2026-01-04T15:46:46.933446Z
false
FuelLabs/fuels-ts
https://github.com/FuelLabs/fuels-ts/blob/9a7b69726b3181a0c2c8f0dd2da83e86774ed1b2/packages/utils/src/utils/isDefined.test.ts
packages/utils/src/utils/isDefined.test.ts
import { isDefined } from './isDefined'; /** * @group node * @group browser */ describe('isDefined', () => { it('should return true for non-undefined values', () => { expect(isDefined(0)).toBe(true); expect(isDefined('')).toBe(true); expect(isDefined(false)).toBe(true); expect(isDefined(null)).toB...
typescript
Apache-2.0
9a7b69726b3181a0c2c8f0dd2da83e86774ed1b2
2026-01-04T15:46:46.933446Z
false
FuelLabs/fuels-ts
https://github.com/FuelLabs/fuels-ts/blob/9a7b69726b3181a0c2c8f0dd2da83e86774ed1b2/packages/utils/src/utils/dataSlice.test.ts
packages/utils/src/utils/dataSlice.test.ts
import { FuelError, ErrorCode } from '@fuel-ts/errors'; import { dataSlice } from './dataSlice'; /** * @group node * @group browser */ describe('dataSlice', () => { it('should slice data correctly', () => { const data = '0x1234567890abcdef'; expect(dataSlice(data, 2, 6)).toBe('0x567890ab'); expect(da...
typescript
Apache-2.0
9a7b69726b3181a0c2c8f0dd2da83e86774ed1b2
2026-01-04T15:46:46.933446Z
false
FuelLabs/fuels-ts
https://github.com/FuelLabs/fuels-ts/blob/9a7b69726b3181a0c2c8f0dd2da83e86774ed1b2/packages/utils/src/utils/toUtf8Bytes.test.ts
packages/utils/src/utils/toUtf8Bytes.test.ts
import { FuelError, ErrorCode } from '@fuel-ts/errors'; import { toUtf8Bytes } from './toUtf8Bytes'; /** * @group node * @group browser */ describe('toUtf8Bytes', () => { it('should convert a simple ASCII string to UTF-8 bytes', () => { const input = 'Hello, world!'; const expectedOutput = new Uint8Array...
typescript
Apache-2.0
9a7b69726b3181a0c2c8f0dd2da83e86774ed1b2
2026-01-04T15:46:46.933446Z
false
FuelLabs/fuels-ts
https://github.com/FuelLabs/fuels-ts/blob/9a7b69726b3181a0c2c8f0dd2da83e86774ed1b2/packages/utils/src/utils/base58.test.ts
packages/utils/src/utils/base58.test.ts
import { FuelError, ErrorCode } from '@fuel-ts/errors'; import { bn } from '@fuel-ts/math'; import { decodeBase58, encodeBase58 } from './base58'; /** * @group node * @group browser */ describe('base58', () => { describe('encodeBase58', () => { it('should encode a BytesLike value to a base58 string', () => {...
typescript
Apache-2.0
9a7b69726b3181a0c2c8f0dd2da83e86774ed1b2
2026-01-04T15:46:46.933446Z
false
FuelLabs/fuels-ts
https://github.com/FuelLabs/fuels-ts/blob/9a7b69726b3181a0c2c8f0dd2da83e86774ed1b2/packages/utils/src/utils/normalizeString.ts
packages/utils/src/utils/normalizeString.ts
import { ErrorCode, FuelError } from '@fuel-ts/errors'; /** * Converts `some.string-value` into `SomeStringValue`. * * Examples: * my-simple.test —— MySimpleTest * myFile.ts —— MyFileTs * my-abi.json —— MyAbiJson */ export const normalizeString = (str: string): string => { const transformations: ((s: strin...
typescript
Apache-2.0
9a7b69726b3181a0c2c8f0dd2da83e86774ed1b2
2026-01-04T15:46:46.933446Z
false
FuelLabs/fuels-ts
https://github.com/FuelLabs/fuels-ts/blob/9a7b69726b3181a0c2c8f0dd2da83e86774ed1b2/packages/utils/src/utils/sleep.ts
packages/utils/src/utils/sleep.ts
export function sleep(time: number) { return new Promise((resolve) => { setTimeout(() => { resolve(true); }, time); }); }
typescript
Apache-2.0
9a7b69726b3181a0c2c8f0dd2da83e86774ed1b2
2026-01-04T15:46:46.933446Z
false
FuelLabs/fuels-ts
https://github.com/FuelLabs/fuels-ts/blob/9a7b69726b3181a0c2c8f0dd2da83e86774ed1b2/packages/utils/src/utils/toUtf8Bytes.ts
packages/utils/src/utils/toUtf8Bytes.ts
import { FuelError, ErrorCode } from '@fuel-ts/errors'; /** * Returns the UTF-8 byte representation of str. * * If form is disabled, the string is not normalized. * @param stri - the string to convert to UTF-8 bytes. * @param form - whether to normalize the string. * @returns - the UTF-8 byte representation of...
typescript
Apache-2.0
9a7b69726b3181a0c2c8f0dd2da83e86774ed1b2
2026-01-04T15:46:46.933446Z
false
FuelLabs/fuels-ts
https://github.com/FuelLabs/fuels-ts/blob/9a7b69726b3181a0c2c8f0dd2da83e86774ed1b2/packages/utils/src/utils/hexlify.test.ts
packages/utils/src/utils/hexlify.test.ts
import { hexlify } from './hexlify'; /** * @group node * @group browser */ describe('hexlify', () => { it('returns hex from bytes', () => { expect(hexlify(new Uint8Array([0, 1, 2, 3]))).toEqual('0x00010203'); }); it('returns hex from string', () => { expect(hexlify('0x01')).toEqual('0x01'); }); ...
typescript
Apache-2.0
9a7b69726b3181a0c2c8f0dd2da83e86774ed1b2
2026-01-04T15:46:46.933446Z
false
FuelLabs/fuels-ts
https://github.com/FuelLabs/fuels-ts/blob/9a7b69726b3181a0c2c8f0dd2da83e86774ed1b2/packages/utils/src/utils/isDefined.ts
packages/utils/src/utils/isDefined.ts
export function isDefined<T>(value: T | undefined): value is T { return value !== undefined; }
typescript
Apache-2.0
9a7b69726b3181a0c2c8f0dd2da83e86774ed1b2
2026-01-04T15:46:46.933446Z
false
FuelLabs/fuels-ts
https://github.com/FuelLabs/fuels-ts/blob/9a7b69726b3181a0c2c8f0dd2da83e86774ed1b2/packages/utils/src/utils/concat.test.ts
packages/utils/src/utils/concat.test.ts
import { arrayify } from './arrayify'; import { concat, concatBytes } from './concat'; /** * @group node * @group browser */ describe('concat', () => { it('should concatenate multiple BytesLike into a single Uint8Array', () => { const byteslike1 = '0xff61ba809b36351b'; const byteslike2 = new Uint8Array([2...
typescript
Apache-2.0
9a7b69726b3181a0c2c8f0dd2da83e86774ed1b2
2026-01-04T15:46:46.933446Z
false
FuelLabs/fuels-ts
https://github.com/FuelLabs/fuels-ts/blob/9a7b69726b3181a0c2c8f0dd2da83e86774ed1b2/packages/utils/src/utils/bytecode.test.ts
packages/utils/src/utils/bytecode.test.ts
import { arrayify } from './arrayify'; import { compressBytecode, decompressBytecode } from './bytecode'; import { sleep } from './sleep'; /** * We are using a base64 encoded bytecode here to avoid having to * read the file from disk. This is because we cannot read files * from the filesystem in a browser testing e...
typescript
Apache-2.0
9a7b69726b3181a0c2c8f0dd2da83e86774ed1b2
2026-01-04T15:46:46.933446Z
false
FuelLabs/fuels-ts
https://github.com/FuelLabs/fuels-ts/blob/9a7b69726b3181a0c2c8f0dd2da83e86774ed1b2/packages/utils/src/utils/date-time.ts
packages/utils/src/utils/date-time.ts
/** * Tai64 timestamp. */ type Tai64Timestamp = string; /** * This constant is used to calculate the offset between the Unix epoch and the TAI64 epoch. * It allows for a **rough** conversion between the two time formats. * * // Value expires on: 28 June 2024 * {@link https://data.iana.org/time-zones/data/leap-...
typescript
Apache-2.0
9a7b69726b3181a0c2c8f0dd2da83e86774ed1b2
2026-01-04T15:46:46.933446Z
false
FuelLabs/fuels-ts
https://github.com/FuelLabs/fuels-ts/blob/9a7b69726b3181a0c2c8f0dd2da83e86774ed1b2/packages/utils/src/utils/normalizeString.test.ts
packages/utils/src/utils/normalizeString.test.ts
import { safeExec } from '@fuel-ts/errors/test-utils'; import { normalizeString } from './normalizeString'; /** * @group node * @group browser */ describe('normalize.ts', () => { test('should normalize strings', () => { expect(normalizeString('DsToken')).toEqual('DsToken'); expect(normalizeString('test')...
typescript
Apache-2.0
9a7b69726b3181a0c2c8f0dd2da83e86774ed1b2
2026-01-04T15:46:46.933446Z
false
FuelLabs/fuels-ts
https://github.com/FuelLabs/fuels-ts/blob/9a7b69726b3181a0c2c8f0dd2da83e86774ed1b2/packages/utils/src/utils/arrayify.ts
packages/utils/src/utils/arrayify.ts
import { FuelError, ErrorCode } from '@fuel-ts/errors'; export type BytesLike = Uint8Array | string; /** * Get a typed Uint8Array from a BytesLike object. * * @param value - the BytesLike data. * @param name - a display name for the error result. * @param copy - create a copy of the original data (if applicable)...
typescript
Apache-2.0
9a7b69726b3181a0c2c8f0dd2da83e86774ed1b2
2026-01-04T15:46:46.933446Z
false
FuelLabs/fuels-ts
https://github.com/FuelLabs/fuels-ts/blob/9a7b69726b3181a0c2c8f0dd2da83e86774ed1b2/packages/utils/src/utils/bytecode.ts
packages/utils/src/utils/bytecode.ts
import { gzipSync, gunzipSync } from 'fflate'; import { arrayify } from './arrayify'; import type { BytesLike } from './arrayify'; export const compressBytecode = (bytecodeAsBinary?: BytesLike) => { if (!bytecodeAsBinary) { return ''; } const bytecodeCompressBytes = arrayify(bytecodeAsBinary); const byte...
typescript
Apache-2.0
9a7b69726b3181a0c2c8f0dd2da83e86774ed1b2
2026-01-04T15:46:46.933446Z
false
FuelLabs/fuels-ts
https://github.com/FuelLabs/fuels-ts/blob/9a7b69726b3181a0c2c8f0dd2da83e86774ed1b2/packages/utils/src/utils/defaultSnapshotConfigs.ts
packages/utils/src/utils/defaultSnapshotConfigs.ts
import chainConfigJson from './defaultSnapshots/chainConfig.json'; import metadataJson from './defaultSnapshots/metadata.json'; import stateConfigJson from './defaultSnapshots/stateConfig.json'; import type { SnapshotConfigs } from './types'; export const defaultSnapshotConfigs: SnapshotConfigs = { chainConfig: chai...
typescript
Apache-2.0
9a7b69726b3181a0c2c8f0dd2da83e86774ed1b2
2026-01-04T15:46:46.933446Z
false
FuelLabs/fuels-ts
https://github.com/FuelLabs/fuels-ts/blob/9a7b69726b3181a0c2c8f0dd2da83e86774ed1b2/packages/utils/src/utils/concat.ts
packages/utils/src/utils/concat.ts
import { arrayify } from './arrayify'; import type { BytesLike } from './arrayify'; /** * Concatenates multiple Uint8Arrays into a single Uint8Array. * * @param arrays - The arrays to concatenate. * @returns - The concatenated array. */ export const concatBytes = ( arrays: ReadonlyArray<Uint8Array> | ReadonlyAr...
typescript
Apache-2.0
9a7b69726b3181a0c2c8f0dd2da83e86774ed1b2
2026-01-04T15:46:46.933446Z
false
FuelLabs/fuels-ts
https://github.com/FuelLabs/fuels-ts/blob/9a7b69726b3181a0c2c8f0dd2da83e86774ed1b2/packages/utils/src/utils/base58.ts
packages/utils/src/utils/base58.ts
import { ErrorCode, FuelError } from '@fuel-ts/errors'; import type { BN } from '@fuel-ts/math'; import { bn } from '@fuel-ts/math'; import { arrayify } from './arrayify'; import type { BytesLike } from './arrayify'; const BN_0 = bn(0); const BN_58 = bn(58); const Alphabet = '123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefgh...
typescript
Apache-2.0
9a7b69726b3181a0c2c8f0dd2da83e86774ed1b2
2026-01-04T15:46:46.933446Z
false
FuelLabs/fuels-ts
https://github.com/FuelLabs/fuels-ts/blob/9a7b69726b3181a0c2c8f0dd2da83e86774ed1b2/packages/utils/src/utils/types.ts
packages/utils/src/utils/types.ts
import type { BigNumberish, BN } from '@fuel-ts/math'; interface Coin { tx_id: string; output_index: number; tx_pointer_block_height: number; tx_pointer_tx_idx: number; owner: string; amount: BigNumberish; asset_id: string; } interface Message { sender: string; recipient: string; nonce: string; ...
typescript
Apache-2.0
9a7b69726b3181a0c2c8f0dd2da83e86774ed1b2
2026-01-04T15:46:46.933446Z
false
FuelLabs/fuels-ts
https://github.com/FuelLabs/fuels-ts/blob/9a7b69726b3181a0c2c8f0dd2da83e86774ed1b2/packages/utils/src/utils/dataSlice.ts
packages/utils/src/utils/dataSlice.ts
import { ErrorCode, FuelError } from '@fuel-ts/errors'; import { arrayify } from './arrayify'; import type { BytesLike } from './arrayify'; import { hexlify } from './hexlify'; /** * Returns a hex string by slicing data from the start offset to the end offset. * * @param data - the data to be sliced. * @param st...
typescript
Apache-2.0
9a7b69726b3181a0c2c8f0dd2da83e86774ed1b2
2026-01-04T15:46:46.933446Z
false
FuelLabs/fuels-ts
https://github.com/FuelLabs/fuels-ts/blob/9a7b69726b3181a0c2c8f0dd2da83e86774ed1b2/packages/utils/src/utils/capitalizeString.test.ts
packages/utils/src/utils/capitalizeString.test.ts
import { capitalizeString } from './capitalizeString'; /** * @group node * @group browser */ describe('capitalizeString', () => { test('should capitalize string', () => { expect(capitalizeString('test')).toEqual('Test'); expect(capitalizeString('')).toEqual(''); }); });
typescript
Apache-2.0
9a7b69726b3181a0c2c8f0dd2da83e86774ed1b2
2026-01-04T15:46:46.933446Z
false
FuelLabs/fuels-ts
https://github.com/FuelLabs/fuels-ts/blob/9a7b69726b3181a0c2c8f0dd2da83e86774ed1b2/packages/utils/src/utils/hexlify.ts
packages/utils/src/utils/hexlify.ts
import { arrayify } from './arrayify'; import type { BytesLike } from './arrayify'; const HexCharacters: string = '0123456789abcdef'; /** * Returns a hex representation of the inputted bytes. */ export function hexlify(data: BytesLike): string { const bytes = arrayify(data); let result = '0x'; for (let i = ...
typescript
Apache-2.0
9a7b69726b3181a0c2c8f0dd2da83e86774ed1b2
2026-01-04T15:46:46.933446Z
false
FuelLabs/fuels-ts
https://github.com/FuelLabs/fuels-ts/blob/9a7b69726b3181a0c2c8f0dd2da83e86774ed1b2/packages/utils/src/utils/chunkAndPadBytes.test.ts
packages/utils/src/utils/chunkAndPadBytes.test.ts
import { arrayify } from '../index'; import { chunkAndPadBytes } from './chunkAndPadBytes'; /** * @group node * @group browser */ describe('chunkAndPadBytes', () => { it('can chunk and pad bytes to 16 KiB', () => { const bytes = arrayify( '0x900000044700000000000000000000345dfcc00110fff3005d4060495d47f...
typescript
Apache-2.0
9a7b69726b3181a0c2c8f0dd2da83e86774ed1b2
2026-01-04T15:46:46.933446Z
false
FuelLabs/fuels-ts
https://github.com/FuelLabs/fuels-ts/blob/9a7b69726b3181a0c2c8f0dd2da83e86774ed1b2/packages/utils/src/utils/toUtf8String.test.ts
packages/utils/src/utils/toUtf8String.test.ts
import { toUtf8String } from './toUtf8String'; /** * @group node * @group browser */ describe('toUtf8String', () => { beforeAll(() => { vi.spyOn(console, 'log').mockImplementation(() => {}); }); it('should convert valid UTF-8 bytes to a string', () => { const bytes = new Uint8Array([72, 101, 108, 108...
typescript
Apache-2.0
9a7b69726b3181a0c2c8f0dd2da83e86774ed1b2
2026-01-04T15:46:46.933446Z
false
FuelLabs/fuels-ts
https://github.com/FuelLabs/fuels-ts/blob/9a7b69726b3181a0c2c8f0dd2da83e86774ed1b2/packages/utils/src/utils/chunkAndPadBytes.ts
packages/utils/src/utils/chunkAndPadBytes.ts
/** * Function to take a byte array and split into chunks of a given size * * @param bytes - The byte array to chunk * @param chunkSize - The size of each chunk * @returns An array of byte arrays of a specified size */ export const chunkAndPadBytes = (bytes: Uint8Array, chunkSize: number): Uint8Array[] => { con...
typescript
Apache-2.0
9a7b69726b3181a0c2c8f0dd2da83e86774ed1b2
2026-01-04T15:46:46.933446Z
false
FuelLabs/fuels-ts
https://github.com/FuelLabs/fuels-ts/blob/9a7b69726b3181a0c2c8f0dd2da83e86774ed1b2/packages/utils/src/cli-utils/tryFindBinaries.test.ts
packages/utils/src/cli-utils/tryFindBinaries.test.ts
import { safeExec } from '@fuel-ts/errors/test-utils'; import * as versionsCliMod from '@fuel-ts/versions/cli'; import * as childProcessMod from 'child_process'; import { tryFindBinaries } from './tryFindBinaries'; vi.mock('child_process', async () => { const mod = await vi.importActual('child_process'); return {...
typescript
Apache-2.0
9a7b69726b3181a0c2c8f0dd2da83e86774ed1b2
2026-01-04T15:46:46.933446Z
false
FuelLabs/fuels-ts
https://github.com/FuelLabs/fuels-ts/blob/9a7b69726b3181a0c2c8f0dd2da83e86774ed1b2/packages/utils/src/cli-utils/tryFindBinaries.ts
packages/utils/src/cli-utils/tryFindBinaries.ts
import { FuelError } from '@fuel-ts/errors'; import { compareSystemVersions, eitherOr, getSystemForc, getSystemFuelCore, getBuiltinVersions, } from '@fuel-ts/versions/cli'; /** * Tries to find compatible binaries on the filesystem, otherwise throws an error. * * @param paths - paths to the binaries (optio...
typescript
Apache-2.0
9a7b69726b3181a0c2c8f0dd2da83e86774ed1b2
2026-01-04T15:46:46.933446Z
false
FuelLabs/fuels-ts
https://github.com/FuelLabs/fuels-ts/blob/9a7b69726b3181a0c2c8f0dd2da83e86774ed1b2/packages/utils/src/test-utils/expectToBeInRange.test.ts
packages/utils/src/test-utils/expectToBeInRange.test.ts
import { FuelError } from '@fuel-ts/errors'; import { expectToThrowFuelError } from '@fuel-ts/errors/test-utils'; import { expectToBeInRange } from './expectToBeInRange'; /** * @group node * @group browser */ describe('expectValueToBeInRange', () => { it('should throw an error when value is less than the minimum...
typescript
Apache-2.0
9a7b69726b3181a0c2c8f0dd2da83e86774ed1b2
2026-01-04T15:46:46.933446Z
false
FuelLabs/fuels-ts
https://github.com/FuelLabs/fuels-ts/blob/9a7b69726b3181a0c2c8f0dd2da83e86774ed1b2/packages/utils/src/test-utils/wait-until-unreachable.test.ts
packages/utils/src/test-utils/wait-until-unreachable.test.ts
import { waitUntilUnreachable } from './wait-until-unreachable'; /** * @group node */ describe('waitUntilUnreachable', () => { afterEach(() => { vi.restoreAllMocks(); }); test('waits until the url is unreachable', async () => { const fetchSpy = vi .spyOn(global, 'fetch') .mockImplementatio...
typescript
Apache-2.0
9a7b69726b3181a0c2c8f0dd2da83e86774ed1b2
2026-01-04T15:46:46.933446Z
false
FuelLabs/fuels-ts
https://github.com/FuelLabs/fuels-ts/blob/9a7b69726b3181a0c2c8f0dd2da83e86774ed1b2/packages/utils/src/test-utils/getForcProject.ts
packages/utils/src/test-utils/getForcProject.ts
import { existsSync, readFileSync } from 'fs'; import { join } from 'path'; import { hexlify } from '../index'; import { normalizeString } from '../utils/normalizeString'; interface IGetForcProjectParams { projectDir: string; projectName: string; build: 'debug' | 'release'; } export const getProjectBuildDir = ...
typescript
Apache-2.0
9a7b69726b3181a0c2c8f0dd2da83e86774ed1b2
2026-01-04T15:46:46.933446Z
false
FuelLabs/fuels-ts
https://github.com/FuelLabs/fuels-ts/blob/9a7b69726b3181a0c2c8f0dd2da83e86774ed1b2/packages/utils/src/test-utils/wait-until-unreachable.ts
packages/utils/src/test-utils/wait-until-unreachable.ts
import { sleep } from '../utils/sleep'; /** * @hidden * * Waits until the given URL is unreachable. Used in tests to verify that fuel-core is no longer running. */ export async function waitUntilUnreachable(url: string) { let isLive; try { await fetch(url); isLive = true; } catch (e) { isLive = f...
typescript
Apache-2.0
9a7b69726b3181a0c2c8f0dd2da83e86774ed1b2
2026-01-04T15:46:46.933446Z
false
FuelLabs/fuels-ts
https://github.com/FuelLabs/fuels-ts/blob/9a7b69726b3181a0c2c8f0dd2da83e86774ed1b2/packages/utils/src/test-utils/vitest.matchers.ts
packages/utils/src/test-utils/vitest.matchers.ts
import { bn } from '@fuel-ts/math'; import type { BN, BNInput } from '@fuel-ts/math'; import type { ExpectStatic as GlobalExpectStatic } from 'vitest'; interface Matchers<R = BN> { toEqualBn: (expected: BNInput) => R; } declare module 'vitest' { interface Assertion extends Matchers {} interface AsymmetricMatcher...
typescript
Apache-2.0
9a7b69726b3181a0c2c8f0dd2da83e86774ed1b2
2026-01-04T15:46:46.933446Z
false
FuelLabs/fuels-ts
https://github.com/FuelLabs/fuels-ts/blob/9a7b69726b3181a0c2c8f0dd2da83e86774ed1b2/packages/utils/src/test-utils/constants.ts
packages/utils/src/test-utils/constants.ts
export const ASSET_A: string = '0x0101010101010101010101010101010101010101010101010101010101010101'; export const ASSET_B: string = '0x0202020202020202020202020202020202020202020202020202020202020202';
typescript
Apache-2.0
9a7b69726b3181a0c2c8f0dd2da83e86774ed1b2
2026-01-04T15:46:46.933446Z
false
FuelLabs/fuels-ts
https://github.com/FuelLabs/fuels-ts/blob/9a7b69726b3181a0c2c8f0dd2da83e86774ed1b2/packages/utils/src/test-utils/expectToBeInRange.ts
packages/utils/src/test-utils/expectToBeInRange.ts
import { FuelError } from '@fuel-ts/errors'; export const expectToBeInRange = (params: { value: number; min: number; max: number }) => { const { value, min, max } = params; if (value >= min && value <= max) { return true; } throw new FuelError( FuelError.CODES.INVALID_INPUT_PARAMETERS, `Expected v...
typescript
Apache-2.0
9a7b69726b3181a0c2c8f0dd2da83e86774ed1b2
2026-01-04T15:46:46.933446Z
false
FuelLabs/fuels-ts
https://github.com/FuelLabs/fuels-ts/blob/9a7b69726b3181a0c2c8f0dd2da83e86774ed1b2/packages/utils/src/test-utils/getForcProject.test.ts
packages/utils/src/test-utils/getForcProject.test.ts
import * as fs from 'fs'; import * as path from 'path'; import * as utilsMod from '../index'; import { getForcProject, getProjectAbiPath, getProjectBinPath, getProjectBuildDir, getProjectNormalizedName, getProjectStorageSlots, getProjectStorageSlotsPath, getProjectTempDir, } from './getForcProject'; ...
typescript
Apache-2.0
9a7b69726b3181a0c2c8f0dd2da83e86774ed1b2
2026-01-04T15:46:46.933446Z
false
FuelLabs/fuels-ts
https://github.com/FuelLabs/fuels-ts/blob/9a7b69726b3181a0c2c8f0dd2da83e86774ed1b2/packages/abi-coder/tsup.config.ts
packages/abi-coder/tsup.config.ts
import { index } from '@internal/tsup'; export default index;
typescript
Apache-2.0
9a7b69726b3181a0c2c8f0dd2da83e86774ed1b2
2026-01-04T15:46:46.933446Z
false
FuelLabs/fuels-ts
https://github.com/FuelLabs/fuels-ts/blob/9a7b69726b3181a0c2c8f0dd2da83e86774ed1b2/packages/abi-coder/src/AbiCoder.ts
packages/abi-coder/src/AbiCoder.ts
import { ResolvedAbiType } from './ResolvedAbiType'; import type { DecodedValue, InputValue, Coder } from './encoding/coders/AbstractCoder'; import { getCoderForEncoding } from './encoding/strategies/getCoderForEncoding'; import type { EncodingOptions } from './types/EncodingOptions'; import type { JsonAbiOld, JsonAbiA...
typescript
Apache-2.0
9a7b69726b3181a0c2c8f0dd2da83e86774ed1b2
2026-01-04T15:46:46.933446Z
false
FuelLabs/fuels-ts
https://github.com/FuelLabs/fuels-ts/blob/9a7b69726b3181a0c2c8f0dd2da83e86774ed1b2/packages/abi-coder/src/ResolvedAbiType.ts
packages/abi-coder/src/ResolvedAbiType.ts
import { FuelError, ErrorCode } from '@fuel-ts/errors'; import type { JsonAbiOld, JsonAbiArgument } from './types/JsonAbi'; import { arrayRegEx, enumRegEx, genericRegEx, stringRegEx, structRegEx } from './utils/constants'; import { findTypeById } from './utils/json-abi'; export class ResolvedAbiType { readonly abi:...
typescript
Apache-2.0
9a7b69726b3181a0c2c8f0dd2da83e86774ed1b2
2026-01-04T15:46:46.933446Z
false
FuelLabs/fuels-ts
https://github.com/FuelLabs/fuels-ts/blob/9a7b69726b3181a0c2c8f0dd2da83e86774ed1b2/packages/abi-coder/src/FunctionFragment.ts
packages/abi-coder/src/FunctionFragment.ts
import { bufferFromString } from '@fuel-ts/crypto'; import { ErrorCode, FuelError } from '@fuel-ts/errors'; import { sha256 } from '@fuel-ts/hasher'; import { bn } from '@fuel-ts/math'; import type { BytesLike } from '@fuel-ts/utils'; import { arrayify } from '@fuel-ts/utils'; import { AbiCoder } from './AbiCoder'; im...
typescript
Apache-2.0
9a7b69726b3181a0c2c8f0dd2da83e86774ed1b2
2026-01-04T15:46:46.933446Z
false
FuelLabs/fuels-ts
https://github.com/FuelLabs/fuels-ts/blob/9a7b69726b3181a0c2c8f0dd2da83e86774ed1b2/packages/abi-coder/src/Interface.ts
packages/abi-coder/src/Interface.ts
/* eslint-disable @typescript-eslint/no-explicit-any */ import { ErrorCode, FuelError } from '@fuel-ts/errors'; import type { BytesLike } from '@fuel-ts/utils'; import { arrayify } from '@fuel-ts/utils'; import { AbiCoder } from './AbiCoder'; import { FunctionFragment } from './FunctionFragment'; import type { Decoded...
typescript
Apache-2.0
9a7b69726b3181a0c2c8f0dd2da83e86774ed1b2
2026-01-04T15:46:46.933446Z
false
FuelLabs/fuels-ts
https://github.com/FuelLabs/fuels-ts/blob/9a7b69726b3181a0c2c8f0dd2da83e86774ed1b2/packages/abi-coder/src/index.ts
packages/abi-coder/src/index.ts
export { Coder, InputValue, DecodedValue } from './encoding/coders/AbstractCoder'; export type { FunctionFragment } from './FunctionFragment'; export * from './encoding/coders'; export { Interface } from './Interface'; export type { JsonAbi, ErrorCode as JsonAbiErrorCode } from './types/JsonAbiNew'; export { SCRIPT_F...
typescript
Apache-2.0
9a7b69726b3181a0c2c8f0dd2da83e86774ed1b2
2026-01-04T15:46:46.933446Z
false
FuelLabs/fuels-ts
https://github.com/FuelLabs/fuels-ts/blob/9a7b69726b3181a0c2c8f0dd2da83e86774ed1b2/packages/abi-coder/src/encoding/coders/BigNumberCoder.test.ts
packages/abi-coder/src/encoding/coders/BigNumberCoder.test.ts
import { ErrorCode, FuelError } from '@fuel-ts/errors'; import { expectToThrowFuelError } from '@fuel-ts/errors/test-utils'; import { BN, bn } from '@fuel-ts/math'; import { U16_MAX, U256_MAX, U32_MAX, U64_MAX, U8_MAX } from '../../../test/utils/constants'; import { BigNumberCoder } from './BigNumberCoder'; const ge...
typescript
Apache-2.0
9a7b69726b3181a0c2c8f0dd2da83e86774ed1b2
2026-01-04T15:46:46.933446Z
false
FuelLabs/fuels-ts
https://github.com/FuelLabs/fuels-ts/blob/9a7b69726b3181a0c2c8f0dd2da83e86774ed1b2/packages/abi-coder/src/encoding/coders/BooleanCoder.test.ts
packages/abi-coder/src/encoding/coders/BooleanCoder.test.ts
import { ErrorCode, FuelError } from '@fuel-ts/errors'; import { expectToThrowFuelError } from '@fuel-ts/errors/test-utils'; import { concat } from '@fuel-ts/utils'; import { WORD_SIZE } from '../../utils/constants'; import { BooleanCoder } from './BooleanCoder'; /** * @group node */ describe('BooleanCoder', () =>...
typescript
Apache-2.0
9a7b69726b3181a0c2c8f0dd2da83e86774ed1b2
2026-01-04T15:46:46.933446Z
false
FuelLabs/fuels-ts
https://github.com/FuelLabs/fuels-ts/blob/9a7b69726b3181a0c2c8f0dd2da83e86774ed1b2/packages/abi-coder/src/encoding/coders/StdStringCoder.ts
packages/abi-coder/src/encoding/coders/StdStringCoder.ts
import { ErrorCode, FuelError } from '@fuel-ts/errors'; import { bn } from '@fuel-ts/math'; import { toUtf8Bytes, toUtf8String } from '@fuel-ts/utils'; import { WORD_SIZE } from '../../utils/constants'; import { Coder } from './AbstractCoder'; import { BigNumberCoder } from './BigNumberCoder'; export class StdString...
typescript
Apache-2.0
9a7b69726b3181a0c2c8f0dd2da83e86774ed1b2
2026-01-04T15:46:46.933446Z
false
FuelLabs/fuels-ts
https://github.com/FuelLabs/fuels-ts/blob/9a7b69726b3181a0c2c8f0dd2da83e86774ed1b2/packages/abi-coder/src/encoding/coders/BigNumberCoder.ts
packages/abi-coder/src/encoding/coders/BigNumberCoder.ts
import { ErrorCode, FuelError } from '@fuel-ts/errors'; import { type BNInput, type BN, toBytes, bn } from '@fuel-ts/math'; import { WORD_SIZE } from '../../utils/constants'; import { Coder } from './AbstractCoder'; type BigNumberCoderType = 'u64' | 'u256'; const encodedLengths: { [key in BigNumberCoderType]: numbe...
typescript
Apache-2.0
9a7b69726b3181a0c2c8f0dd2da83e86774ed1b2
2026-01-04T15:46:46.933446Z
false
FuelLabs/fuels-ts
https://github.com/FuelLabs/fuels-ts/blob/9a7b69726b3181a0c2c8f0dd2da83e86774ed1b2/packages/abi-coder/src/encoding/coders/ArrayCoder.ts
packages/abi-coder/src/encoding/coders/ArrayCoder.ts
import { ErrorCode, FuelError } from '@fuel-ts/errors'; import { concat } from '@fuel-ts/utils'; import { MAX_BYTES } from '../../utils/constants'; import { hasNestedOption } from '../../utils/utilities'; import type { TypesOfCoder } from './AbstractCoder'; import { Coder } from './AbstractCoder'; type InputValueOf<...
typescript
Apache-2.0
9a7b69726b3181a0c2c8f0dd2da83e86774ed1b2
2026-01-04T15:46:46.933446Z
false
FuelLabs/fuels-ts
https://github.com/FuelLabs/fuels-ts/blob/9a7b69726b3181a0c2c8f0dd2da83e86774ed1b2/packages/abi-coder/src/encoding/coders/EnumCoder.ts
packages/abi-coder/src/encoding/coders/EnumCoder.ts
import { ErrorCode, FuelError } from '@fuel-ts/errors'; import { toNumber } from '@fuel-ts/math'; import { concat } from '@fuel-ts/utils'; import type { RequireExactlyOne } from 'type-fest'; import { OPTION_CODER_TYPE, optionRegEx, VOID_TYPE } from '../../utils/constants'; import { hasNestedOption } from '../../utils/...
typescript
Apache-2.0
9a7b69726b3181a0c2c8f0dd2da83e86774ed1b2
2026-01-04T15:46:46.933446Z
false
FuelLabs/fuels-ts
https://github.com/FuelLabs/fuels-ts/blob/9a7b69726b3181a0c2c8f0dd2da83e86774ed1b2/packages/abi-coder/src/encoding/coders/B256Coder.test.ts
packages/abi-coder/src/encoding/coders/B256Coder.test.ts
import { ErrorCode, FuelError } from '@fuel-ts/errors'; import { expectToThrowFuelError } from '@fuel-ts/errors/test-utils'; import { B256Coder } from './B256Coder'; /** * @group node * @group browser */ describe('B256Coder', () => { const B256_DECODED = '0xd5579c46dfcc7f18207013e65b44e4cb4e2c2298f4ac457ba8f8274...
typescript
Apache-2.0
9a7b69726b3181a0c2c8f0dd2da83e86774ed1b2
2026-01-04T15:46:46.933446Z
false
FuelLabs/fuels-ts
https://github.com/FuelLabs/fuels-ts/blob/9a7b69726b3181a0c2c8f0dd2da83e86774ed1b2/packages/abi-coder/src/encoding/coders/VoidCoder.ts
packages/abi-coder/src/encoding/coders/VoidCoder.ts
import { VOID_TYPE } from '../../utils/constants'; import { Coder } from './AbstractCoder'; export class VoidCoder extends Coder<undefined, undefined> { constructor() { super('void', VOID_TYPE, 0); } encode(_value: undefined): Uint8Array { return new Uint8Array([]); } decode(_data: Uint8Array, off...
typescript
Apache-2.0
9a7b69726b3181a0c2c8f0dd2da83e86774ed1b2
2026-01-04T15:46:46.933446Z
false
FuelLabs/fuels-ts
https://github.com/FuelLabs/fuels-ts/blob/9a7b69726b3181a0c2c8f0dd2da83e86774ed1b2/packages/abi-coder/src/encoding/coders/StrSliceCoder.ts
packages/abi-coder/src/encoding/coders/StrSliceCoder.ts
import { ErrorCode, FuelError } from '@fuel-ts/errors'; import { bn } from '@fuel-ts/math'; import { toUtf8Bytes, toUtf8String } from '@fuel-ts/utils'; import { WORD_SIZE } from '../../utils/constants'; import { Coder } from './AbstractCoder'; import { BigNumberCoder } from './BigNumberCoder'; export class StrSliceC...
typescript
Apache-2.0
9a7b69726b3181a0c2c8f0dd2da83e86774ed1b2
2026-01-04T15:46:46.933446Z
false
FuelLabs/fuels-ts
https://github.com/FuelLabs/fuels-ts/blob/9a7b69726b3181a0c2c8f0dd2da83e86774ed1b2/packages/abi-coder/src/encoding/coders/StrSliceCoder.test.ts
packages/abi-coder/src/encoding/coders/StrSliceCoder.test.ts
import { ErrorCode, FuelError } from '@fuel-ts/errors'; import { expectToThrowFuelError } from '@fuel-ts/errors/test-utils'; import { StrSliceCoder } from './StrSliceCoder'; /** * @group node * @group browser */ describe('StrSliceCoder', () => { const coder = new StrSliceCoder(); it('should encode an empty st...
typescript
Apache-2.0
9a7b69726b3181a0c2c8f0dd2da83e86774ed1b2
2026-01-04T15:46:46.933446Z
false
FuelLabs/fuels-ts
https://github.com/FuelLabs/fuels-ts/blob/9a7b69726b3181a0c2c8f0dd2da83e86774ed1b2/packages/abi-coder/src/encoding/coders/B512Coder.test.ts
packages/abi-coder/src/encoding/coders/B512Coder.test.ts
import { ErrorCode, FuelError } from '@fuel-ts/errors'; import { expectToThrowFuelError } from '@fuel-ts/errors/test-utils'; import { B512Coder } from './B512Coder'; /** * @group node * @group browser */ describe('B512Coder', () => { const B512_DECODED = '0x8e9dda6f7793745ac5aacf9e907cae30b2a01fdf0d23b7750a8...
typescript
Apache-2.0
9a7b69726b3181a0c2c8f0dd2da83e86774ed1b2
2026-01-04T15:46:46.933446Z
false
FuelLabs/fuels-ts
https://github.com/FuelLabs/fuels-ts/blob/9a7b69726b3181a0c2c8f0dd2da83e86774ed1b2/packages/abi-coder/src/encoding/coders/StringCoder.test.ts
packages/abi-coder/src/encoding/coders/StringCoder.test.ts
import { ErrorCode, FuelError } from '@fuel-ts/errors'; import { expectToThrowFuelError } from '@fuel-ts/errors/test-utils'; import { StringCoder } from './StringCoder'; /** * @group node * @group browser */ describe('StringCoder', () => { it('should encode a string', () => { const coder = new StringCoder(4)...
typescript
Apache-2.0
9a7b69726b3181a0c2c8f0dd2da83e86774ed1b2
2026-01-04T15:46:46.933446Z
false
FuelLabs/fuels-ts
https://github.com/FuelLabs/fuels-ts/blob/9a7b69726b3181a0c2c8f0dd2da83e86774ed1b2/packages/abi-coder/src/encoding/coders/StringCoder.ts
packages/abi-coder/src/encoding/coders/StringCoder.ts
import { ErrorCode, FuelError } from '@fuel-ts/errors'; import { toUtf8Bytes, toUtf8String } from '@fuel-ts/utils'; import { Coder } from './AbstractCoder'; export class StringCoder<TLength extends number = number> extends Coder<string, string> { constructor(length: TLength) { super('string', `str[${length}]`, ...
typescript
Apache-2.0
9a7b69726b3181a0c2c8f0dd2da83e86774ed1b2
2026-01-04T15:46:46.933446Z
false
FuelLabs/fuels-ts
https://github.com/FuelLabs/fuels-ts/blob/9a7b69726b3181a0c2c8f0dd2da83e86774ed1b2/packages/abi-coder/src/encoding/coders/RawSliceCoder.test.ts
packages/abi-coder/src/encoding/coders/RawSliceCoder.test.ts
import { FuelError, ErrorCode } from '@fuel-ts/errors'; import { expectToThrowFuelError } from '@fuel-ts/errors/test-utils'; import { RawSliceCoder } from './RawSliceCoder'; /** * @group node * @group browser */ describe('RawSliceCoder', () => { const coder = new RawSliceCoder(); it('should encode a raw-slice...
typescript
Apache-2.0
9a7b69726b3181a0c2c8f0dd2da83e86774ed1b2
2026-01-04T15:46:46.933446Z
false
FuelLabs/fuels-ts
https://github.com/FuelLabs/fuels-ts/blob/9a7b69726b3181a0c2c8f0dd2da83e86774ed1b2/packages/abi-coder/src/encoding/coders/ArrayCoder.test.ts
packages/abi-coder/src/encoding/coders/ArrayCoder.test.ts
import { FuelError, ErrorCode } from '@fuel-ts/errors'; import { expectToThrowFuelError } from '@fuel-ts/errors/test-utils'; import { U32_MAX, U8_MAX } from '../../../test/utils/constants'; import { ArrayCoder } from './ArrayCoder'; import { BooleanCoder } from './BooleanCoder'; import { EnumCoder } from './EnumCoder...
typescript
Apache-2.0
9a7b69726b3181a0c2c8f0dd2da83e86774ed1b2
2026-01-04T15:46:46.933446Z
false
FuelLabs/fuels-ts
https://github.com/FuelLabs/fuels-ts/blob/9a7b69726b3181a0c2c8f0dd2da83e86774ed1b2/packages/abi-coder/src/encoding/coders/ByteCoder.ts
packages/abi-coder/src/encoding/coders/ByteCoder.ts
import { ErrorCode, FuelError } from '@fuel-ts/errors'; import { bn } from '@fuel-ts/math'; import { WORD_SIZE } from '../../utils/constants'; import { Coder } from './AbstractCoder'; import { BigNumberCoder } from './BigNumberCoder'; export class ByteCoder extends Coder<number[], Uint8Array> { static memorySize =...
typescript
Apache-2.0
9a7b69726b3181a0c2c8f0dd2da83e86774ed1b2
2026-01-04T15:46:46.933446Z
false
FuelLabs/fuels-ts
https://github.com/FuelLabs/fuels-ts/blob/9a7b69726b3181a0c2c8f0dd2da83e86774ed1b2/packages/abi-coder/src/encoding/coders/RawSliceCoder.ts
packages/abi-coder/src/encoding/coders/RawSliceCoder.ts
import { ErrorCode, FuelError } from '@fuel-ts/errors'; import { bn } from '@fuel-ts/math'; import { WORD_SIZE } from '../../utils/constants'; import { Coder } from './AbstractCoder'; import { ArrayCoder } from './ArrayCoder'; import { BigNumberCoder } from './BigNumberCoder'; import { NumberCoder } from './NumberCod...
typescript
Apache-2.0
9a7b69726b3181a0c2c8f0dd2da83e86774ed1b2
2026-01-04T15:46:46.933446Z
false
FuelLabs/fuels-ts
https://github.com/FuelLabs/fuels-ts/blob/9a7b69726b3181a0c2c8f0dd2da83e86774ed1b2/packages/abi-coder/src/encoding/coders/ByteCoder.test.ts
packages/abi-coder/src/encoding/coders/ByteCoder.test.ts
import { FuelError, ErrorCode } from '@fuel-ts/errors'; import { expectToThrowFuelError } from '@fuel-ts/errors/test-utils'; import { ByteCoder } from './ByteCoder'; /** * @group node * @group browser */ describe('ByteCoder', () => { const coder = new ByteCoder(); it('should encode a byte', () => { const ...
typescript
Apache-2.0
9a7b69726b3181a0c2c8f0dd2da83e86774ed1b2
2026-01-04T15:46:46.933446Z
false
FuelLabs/fuels-ts
https://github.com/FuelLabs/fuels-ts/blob/9a7b69726b3181a0c2c8f0dd2da83e86774ed1b2/packages/abi-coder/src/encoding/coders/B512Coder.ts
packages/abi-coder/src/encoding/coders/B512Coder.ts
import { ErrorCode, FuelError } from '@fuel-ts/errors'; import { bn, toHex } from '@fuel-ts/math'; import { arrayify } from '@fuel-ts/utils'; import { WORD_SIZE } from '../../utils/constants'; import { Coder } from './AbstractCoder'; export class B512Coder extends Coder<string, string> { constructor() { super(...
typescript
Apache-2.0
9a7b69726b3181a0c2c8f0dd2da83e86774ed1b2
2026-01-04T15:46:46.933446Z
false
FuelLabs/fuels-ts
https://github.com/FuelLabs/fuels-ts/blob/9a7b69726b3181a0c2c8f0dd2da83e86774ed1b2/packages/abi-coder/src/encoding/coders/B256Coder.ts
packages/abi-coder/src/encoding/coders/B256Coder.ts
import { ErrorCode, FuelError } from '@fuel-ts/errors'; import { bn, toHex } from '@fuel-ts/math'; import { arrayify } from '@fuel-ts/utils'; import { WORD_SIZE } from '../../utils/constants'; import { Coder } from './AbstractCoder'; export class B256Coder extends Coder<string, string> { constructor() { super(...
typescript
Apache-2.0
9a7b69726b3181a0c2c8f0dd2da83e86774ed1b2
2026-01-04T15:46:46.933446Z
false
FuelLabs/fuels-ts
https://github.com/FuelLabs/fuels-ts/blob/9a7b69726b3181a0c2c8f0dd2da83e86774ed1b2/packages/abi-coder/src/encoding/coders/VecCoder.ts
packages/abi-coder/src/encoding/coders/VecCoder.ts
import { ErrorCode, FuelError } from '@fuel-ts/errors'; import { bn } from '@fuel-ts/math'; import { concatBytes } from '@fuel-ts/utils'; import { MAX_BYTES, WORD_SIZE } from '../../utils/constants'; import { hasNestedOption, isUint8Array } from '../../utils/utilities'; import { Coder } from './AbstractCoder'; import...
typescript
Apache-2.0
9a7b69726b3181a0c2c8f0dd2da83e86774ed1b2
2026-01-04T15:46:46.933446Z
false
FuelLabs/fuels-ts
https://github.com/FuelLabs/fuels-ts/blob/9a7b69726b3181a0c2c8f0dd2da83e86774ed1b2/packages/abi-coder/src/encoding/coders/NumberCoder.test.ts
packages/abi-coder/src/encoding/coders/NumberCoder.test.ts
import { ErrorCode, FuelError } from '@fuel-ts/errors'; import { expectToThrowFuelError } from '@fuel-ts/errors/test-utils'; import { U8_MAX, U16_MAX, U32_MAX } from '../../../test/utils/constants'; import { NumberCoder } from './NumberCoder'; /** * @group node * @group browser */ describe('NumberCoder', () => { ...
typescript
Apache-2.0
9a7b69726b3181a0c2c8f0dd2da83e86774ed1b2
2026-01-04T15:46:46.933446Z
false
FuelLabs/fuels-ts
https://github.com/FuelLabs/fuels-ts/blob/9a7b69726b3181a0c2c8f0dd2da83e86774ed1b2/packages/abi-coder/src/encoding/coders/OptionCoder.ts
packages/abi-coder/src/encoding/coders/OptionCoder.ts
import type { Coder } from './AbstractCoder'; import type { InputValueOf, DecodedValueOf } from './EnumCoder'; import { EnumCoder } from './EnumCoder'; type SwayOption<T> = { None: [] } | { Some: T }; export type Option<T> = T | undefined; export class OptionCoder<TCoders extends Record<string, Coder>> extends EnumCo...
typescript
Apache-2.0
9a7b69726b3181a0c2c8f0dd2da83e86774ed1b2
2026-01-04T15:46:46.933446Z
false
FuelLabs/fuels-ts
https://github.com/FuelLabs/fuels-ts/blob/9a7b69726b3181a0c2c8f0dd2da83e86774ed1b2/packages/abi-coder/src/encoding/coders/StructCoder.test.ts
packages/abi-coder/src/encoding/coders/StructCoder.test.ts
import { FuelError, ErrorCode } from '@fuel-ts/errors'; import { expectToThrowFuelError } from '@fuel-ts/errors/test-utils'; import { bn } from '@fuel-ts/math'; import { U32_MAX } from '../../../test/utils/constants'; import { BigNumberCoder } from './BigNumberCoder'; import { BooleanCoder } from './BooleanCoder'; im...
typescript
Apache-2.0
9a7b69726b3181a0c2c8f0dd2da83e86774ed1b2
2026-01-04T15:46:46.933446Z
false
FuelLabs/fuels-ts
https://github.com/FuelLabs/fuels-ts/blob/9a7b69726b3181a0c2c8f0dd2da83e86774ed1b2/packages/abi-coder/src/encoding/coders/BooleanCoder.ts
packages/abi-coder/src/encoding/coders/BooleanCoder.ts
import { ErrorCode, FuelError } from '@fuel-ts/errors'; import { bn, toBytes } from '@fuel-ts/math'; import type { EncodingOptions } from '../../types/EncodingOptions'; import { WORD_SIZE } from '../../utils/constants'; import { Coder } from './AbstractCoder'; export class BooleanCoder extends Coder<boolean, boolean...
typescript
Apache-2.0
9a7b69726b3181a0c2c8f0dd2da83e86774ed1b2
2026-01-04T15:46:46.933446Z
false
FuelLabs/fuels-ts
https://github.com/FuelLabs/fuels-ts/blob/9a7b69726b3181a0c2c8f0dd2da83e86774ed1b2/packages/abi-coder/src/encoding/coders/OptionCoder.test.ts
packages/abi-coder/src/encoding/coders/OptionCoder.test.ts
import { NumberCoder } from './NumberCoder'; import { OptionCoder } from './OptionCoder'; import { VoidCoder } from './VoidCoder'; /** * @group node * @group browser */ describe('OptionCoder', () => { const coder = new OptionCoder('std::option::Option', { Some: new NumberCoder('u8'), None: new VoidCoder()...
typescript
Apache-2.0
9a7b69726b3181a0c2c8f0dd2da83e86774ed1b2
2026-01-04T15:46:46.933446Z
false
FuelLabs/fuels-ts
https://github.com/FuelLabs/fuels-ts/blob/9a7b69726b3181a0c2c8f0dd2da83e86774ed1b2/packages/abi-coder/src/encoding/coders/EnumCoder.test.ts
packages/abi-coder/src/encoding/coders/EnumCoder.test.ts
import { ErrorCode, FuelError } from '@fuel-ts/errors'; import { expectToThrowFuelError } from '@fuel-ts/errors/test-utils'; import { bn } from '@fuel-ts/math'; import { U64_MAX } from '../../../test/utils/constants'; import { BigNumberCoder } from './BigNumberCoder'; import { BooleanCoder } from './BooleanCoder'; im...
typescript
Apache-2.0
9a7b69726b3181a0c2c8f0dd2da83e86774ed1b2
2026-01-04T15:46:46.933446Z
false