@fuel-ts/account 0.0.0-rc-2143-20240520152005 → 0.0.0-rc-1356-20240520163254
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.
Potentially problematic release.
This version of @fuel-ts/account might be problematic. Click here for more details.
- package/dist/index.global.js +7 -9
- package/dist/index.global.js.map +1 -1
- package/dist/index.js +115 -125
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1 -10
- package/dist/index.mjs.map +1 -1
- package/dist/providers/utils/auto-retry-fetch.d.ts.map +1 -1
- package/dist/providers/utils/index.d.ts +0 -1
- package/dist/providers/utils/index.d.ts.map +1 -1
- package/dist/test-utils/asset-id.d.ts +8 -0
- package/dist/test-utils/asset-id.d.ts.map +1 -0
- package/dist/test-utils/index.d.ts +4 -0
- package/dist/test-utils/index.d.ts.map +1 -1
- package/dist/test-utils/launchNode.d.ts +10 -3
- package/dist/test-utils/launchNode.d.ts.map +1 -1
- package/dist/test-utils/setup-test-provider-and-wallets.d.ts +33 -0
- package/dist/test-utils/setup-test-provider-and-wallets.d.ts.map +1 -0
- package/dist/test-utils/test-message.d.ts +29 -0
- package/dist/test-utils/test-message.d.ts.map +1 -0
- package/dist/test-utils/wallet-config.d.ts +55 -0
- package/dist/test-utils/wallet-config.d.ts.map +1 -0
- package/dist/test-utils.global.js +465 -122
- package/dist/test-utils.global.js.map +1 -1
- package/dist/test-utils.js +407 -169
- package/dist/test-utils.js.map +1 -1
- package/dist/test-utils.mjs +301 -67
- package/dist/test-utils.mjs.map +1 -1
- package/package.json +16 -15
- package/dist/providers/utils/sleep.d.ts +0 -3
- package/dist/providers/utils/sleep.d.ts.map +0 -1
@@ -9511,16 +9511,16 @@ spurious results.`);
|
|
9511
9511
|
},
|
9512
9512
|
// Document
|
9513
9513
|
Document: {
|
9514
|
-
leave: (node) =>
|
9514
|
+
leave: (node) => join3(node.definitions, "\n\n")
|
9515
9515
|
},
|
9516
9516
|
OperationDefinition: {
|
9517
9517
|
leave(node) {
|
9518
|
-
const varDefs = wrap2("(",
|
9519
|
-
const prefix =
|
9518
|
+
const varDefs = wrap2("(", join3(node.variableDefinitions, ", "), ")");
|
9519
|
+
const prefix = join3(
|
9520
9520
|
[
|
9521
9521
|
node.operation,
|
9522
|
-
|
9523
|
-
|
9522
|
+
join3([node.name, varDefs]),
|
9523
|
+
join3(node.directives, " ")
|
9524
9524
|
],
|
9525
9525
|
" "
|
9526
9526
|
);
|
@@ -9528,7 +9528,7 @@ spurious results.`);
|
|
9528
9528
|
}
|
9529
9529
|
},
|
9530
9530
|
VariableDefinition: {
|
9531
|
-
leave: ({ variable, type: type3, defaultValue, directives }) => variable + ": " + type3 + wrap2(" = ", defaultValue) + wrap2(" ",
|
9531
|
+
leave: ({ variable, type: type3, defaultValue, directives }) => variable + ": " + type3 + wrap2(" = ", defaultValue) + wrap2(" ", join3(directives, " "))
|
9532
9532
|
},
|
9533
9533
|
SelectionSet: {
|
9534
9534
|
leave: ({ selections }) => block2(selections)
|
@@ -9536,11 +9536,11 @@ spurious results.`);
|
|
9536
9536
|
Field: {
|
9537
9537
|
leave({ alias, name, arguments: args, directives, selectionSet }) {
|
9538
9538
|
const prefix = wrap2("", alias, ": ") + name;
|
9539
|
-
let argsLine = prefix + wrap2("(",
|
9539
|
+
let argsLine = prefix + wrap2("(", join3(args, ", "), ")");
|
9540
9540
|
if (argsLine.length > MAX_LINE_LENGTH2) {
|
9541
|
-
argsLine = prefix + wrap2("(\n", indent2(
|
9541
|
+
argsLine = prefix + wrap2("(\n", indent2(join3(args, "\n")), "\n)");
|
9542
9542
|
}
|
9543
|
-
return
|
9543
|
+
return join3([argsLine, join3(directives, " "), selectionSet], " ");
|
9544
9544
|
}
|
9545
9545
|
},
|
9546
9546
|
Argument: {
|
@@ -9548,14 +9548,14 @@ spurious results.`);
|
|
9548
9548
|
},
|
9549
9549
|
// Fragments
|
9550
9550
|
FragmentSpread: {
|
9551
|
-
leave: ({ name, directives }) => "..." + name + wrap2(" ",
|
9551
|
+
leave: ({ name, directives }) => "..." + name + wrap2(" ", join3(directives, " "))
|
9552
9552
|
},
|
9553
9553
|
InlineFragment: {
|
9554
|
-
leave: ({ typeCondition, directives, selectionSet }) =>
|
9554
|
+
leave: ({ typeCondition, directives, selectionSet }) => join3(
|
9555
9555
|
[
|
9556
9556
|
"...",
|
9557
9557
|
wrap2("on ", typeCondition),
|
9558
|
-
|
9558
|
+
join3(directives, " "),
|
9559
9559
|
selectionSet
|
9560
9560
|
],
|
9561
9561
|
" "
|
@@ -9564,7 +9564,7 @@ spurious results.`);
|
|
9564
9564
|
FragmentDefinition: {
|
9565
9565
|
leave: ({ name, typeCondition, variableDefinitions, directives, selectionSet }) => (
|
9566
9566
|
// or removed in the future.
|
9567
|
-
`fragment ${name}${wrap2("(",
|
9567
|
+
`fragment ${name}${wrap2("(", join3(variableDefinitions, ", "), ")")} on ${typeCondition} ${wrap2("", join3(directives, " "), " ")}` + selectionSet
|
9568
9568
|
)
|
9569
9569
|
},
|
9570
9570
|
// Value
|
@@ -9587,17 +9587,17 @@ spurious results.`);
|
|
9587
9587
|
leave: ({ value }) => value
|
9588
9588
|
},
|
9589
9589
|
ListValue: {
|
9590
|
-
leave: ({ values }) => "[" +
|
9590
|
+
leave: ({ values }) => "[" + join3(values, ", ") + "]"
|
9591
9591
|
},
|
9592
9592
|
ObjectValue: {
|
9593
|
-
leave: ({ fields }) => "{" +
|
9593
|
+
leave: ({ fields }) => "{" + join3(fields, ", ") + "}"
|
9594
9594
|
},
|
9595
9595
|
ObjectField: {
|
9596
9596
|
leave: ({ name, value }) => name + ": " + value
|
9597
9597
|
},
|
9598
9598
|
// Directive
|
9599
9599
|
Directive: {
|
9600
|
-
leave: ({ name, arguments: args }) => "@" + name + wrap2("(",
|
9600
|
+
leave: ({ name, arguments: args }) => "@" + name + wrap2("(", join3(args, ", "), ")")
|
9601
9601
|
},
|
9602
9602
|
// Type
|
9603
9603
|
NamedType: {
|
@@ -9611,122 +9611,122 @@ spurious results.`);
|
|
9611
9611
|
},
|
9612
9612
|
// Type System Definitions
|
9613
9613
|
SchemaDefinition: {
|
9614
|
-
leave: ({ description, directives, operationTypes }) => wrap2("", description, "\n") +
|
9614
|
+
leave: ({ description, directives, operationTypes }) => wrap2("", description, "\n") + join3(["schema", join3(directives, " "), block2(operationTypes)], " ")
|
9615
9615
|
},
|
9616
9616
|
OperationTypeDefinition: {
|
9617
9617
|
leave: ({ operation, type: type3 }) => operation + ": " + type3
|
9618
9618
|
},
|
9619
9619
|
ScalarTypeDefinition: {
|
9620
|
-
leave: ({ description, name, directives }) => wrap2("", description, "\n") +
|
9620
|
+
leave: ({ description, name, directives }) => wrap2("", description, "\n") + join3(["scalar", name, join3(directives, " ")], " ")
|
9621
9621
|
},
|
9622
9622
|
ObjectTypeDefinition: {
|
9623
|
-
leave: ({ description, name, interfaces, directives, fields }) => wrap2("", description, "\n") +
|
9623
|
+
leave: ({ description, name, interfaces, directives, fields }) => wrap2("", description, "\n") + join3(
|
9624
9624
|
[
|
9625
9625
|
"type",
|
9626
9626
|
name,
|
9627
|
-
wrap2("implements ",
|
9628
|
-
|
9627
|
+
wrap2("implements ", join3(interfaces, " & ")),
|
9628
|
+
join3(directives, " "),
|
9629
9629
|
block2(fields)
|
9630
9630
|
],
|
9631
9631
|
" "
|
9632
9632
|
)
|
9633
9633
|
},
|
9634
9634
|
FieldDefinition: {
|
9635
|
-
leave: ({ description, name, arguments: args, type: type3, directives }) => wrap2("", description, "\n") + name + (hasMultilineItems2(args) ? wrap2("(\n", indent2(
|
9635
|
+
leave: ({ description, name, arguments: args, type: type3, directives }) => wrap2("", description, "\n") + name + (hasMultilineItems2(args) ? wrap2("(\n", indent2(join3(args, "\n")), "\n)") : wrap2("(", join3(args, ", "), ")")) + ": " + type3 + wrap2(" ", join3(directives, " "))
|
9636
9636
|
},
|
9637
9637
|
InputValueDefinition: {
|
9638
|
-
leave: ({ description, name, type: type3, defaultValue, directives }) => wrap2("", description, "\n") +
|
9639
|
-
[name + ": " + type3, wrap2("= ", defaultValue),
|
9638
|
+
leave: ({ description, name, type: type3, defaultValue, directives }) => wrap2("", description, "\n") + join3(
|
9639
|
+
[name + ": " + type3, wrap2("= ", defaultValue), join3(directives, " ")],
|
9640
9640
|
" "
|
9641
9641
|
)
|
9642
9642
|
},
|
9643
9643
|
InterfaceTypeDefinition: {
|
9644
|
-
leave: ({ description, name, interfaces, directives, fields }) => wrap2("", description, "\n") +
|
9644
|
+
leave: ({ description, name, interfaces, directives, fields }) => wrap2("", description, "\n") + join3(
|
9645
9645
|
[
|
9646
9646
|
"interface",
|
9647
9647
|
name,
|
9648
|
-
wrap2("implements ",
|
9649
|
-
|
9648
|
+
wrap2("implements ", join3(interfaces, " & ")),
|
9649
|
+
join3(directives, " "),
|
9650
9650
|
block2(fields)
|
9651
9651
|
],
|
9652
9652
|
" "
|
9653
9653
|
)
|
9654
9654
|
},
|
9655
9655
|
UnionTypeDefinition: {
|
9656
|
-
leave: ({ description, name, directives, types }) => wrap2("", description, "\n") +
|
9657
|
-
["union", name,
|
9656
|
+
leave: ({ description, name, directives, types }) => wrap2("", description, "\n") + join3(
|
9657
|
+
["union", name, join3(directives, " "), wrap2("= ", join3(types, " | "))],
|
9658
9658
|
" "
|
9659
9659
|
)
|
9660
9660
|
},
|
9661
9661
|
EnumTypeDefinition: {
|
9662
|
-
leave: ({ description, name, directives, values }) => wrap2("", description, "\n") +
|
9662
|
+
leave: ({ description, name, directives, values }) => wrap2("", description, "\n") + join3(["enum", name, join3(directives, " "), block2(values)], " ")
|
9663
9663
|
},
|
9664
9664
|
EnumValueDefinition: {
|
9665
|
-
leave: ({ description, name, directives }) => wrap2("", description, "\n") +
|
9665
|
+
leave: ({ description, name, directives }) => wrap2("", description, "\n") + join3([name, join3(directives, " ")], " ")
|
9666
9666
|
},
|
9667
9667
|
InputObjectTypeDefinition: {
|
9668
|
-
leave: ({ description, name, directives, fields }) => wrap2("", description, "\n") +
|
9668
|
+
leave: ({ description, name, directives, fields }) => wrap2("", description, "\n") + join3(["input", name, join3(directives, " "), block2(fields)], " ")
|
9669
9669
|
},
|
9670
9670
|
DirectiveDefinition: {
|
9671
|
-
leave: ({ description, name, arguments: args, repeatable, locations }) => wrap2("", description, "\n") + "directive @" + name + (hasMultilineItems2(args) ? wrap2("(\n", indent2(
|
9671
|
+
leave: ({ description, name, arguments: args, repeatable, locations }) => wrap2("", description, "\n") + "directive @" + name + (hasMultilineItems2(args) ? wrap2("(\n", indent2(join3(args, "\n")), "\n)") : wrap2("(", join3(args, ", "), ")")) + (repeatable ? " repeatable" : "") + " on " + join3(locations, " | ")
|
9672
9672
|
},
|
9673
9673
|
SchemaExtension: {
|
9674
|
-
leave: ({ directives, operationTypes }) =>
|
9675
|
-
["extend schema",
|
9674
|
+
leave: ({ directives, operationTypes }) => join3(
|
9675
|
+
["extend schema", join3(directives, " "), block2(operationTypes)],
|
9676
9676
|
" "
|
9677
9677
|
)
|
9678
9678
|
},
|
9679
9679
|
ScalarTypeExtension: {
|
9680
|
-
leave: ({ name, directives }) =>
|
9680
|
+
leave: ({ name, directives }) => join3(["extend scalar", name, join3(directives, " ")], " ")
|
9681
9681
|
},
|
9682
9682
|
ObjectTypeExtension: {
|
9683
|
-
leave: ({ name, interfaces, directives, fields }) =>
|
9683
|
+
leave: ({ name, interfaces, directives, fields }) => join3(
|
9684
9684
|
[
|
9685
9685
|
"extend type",
|
9686
9686
|
name,
|
9687
|
-
wrap2("implements ",
|
9688
|
-
|
9687
|
+
wrap2("implements ", join3(interfaces, " & ")),
|
9688
|
+
join3(directives, " "),
|
9689
9689
|
block2(fields)
|
9690
9690
|
],
|
9691
9691
|
" "
|
9692
9692
|
)
|
9693
9693
|
},
|
9694
9694
|
InterfaceTypeExtension: {
|
9695
|
-
leave: ({ name, interfaces, directives, fields }) =>
|
9695
|
+
leave: ({ name, interfaces, directives, fields }) => join3(
|
9696
9696
|
[
|
9697
9697
|
"extend interface",
|
9698
9698
|
name,
|
9699
|
-
wrap2("implements ",
|
9700
|
-
|
9699
|
+
wrap2("implements ", join3(interfaces, " & ")),
|
9700
|
+
join3(directives, " "),
|
9701
9701
|
block2(fields)
|
9702
9702
|
],
|
9703
9703
|
" "
|
9704
9704
|
)
|
9705
9705
|
},
|
9706
9706
|
UnionTypeExtension: {
|
9707
|
-
leave: ({ name, directives, types }) =>
|
9707
|
+
leave: ({ name, directives, types }) => join3(
|
9708
9708
|
[
|
9709
9709
|
"extend union",
|
9710
9710
|
name,
|
9711
|
-
|
9712
|
-
wrap2("= ",
|
9711
|
+
join3(directives, " "),
|
9712
|
+
wrap2("= ", join3(types, " | "))
|
9713
9713
|
],
|
9714
9714
|
" "
|
9715
9715
|
)
|
9716
9716
|
},
|
9717
9717
|
EnumTypeExtension: {
|
9718
|
-
leave: ({ name, directives, values }) =>
|
9718
|
+
leave: ({ name, directives, values }) => join3(["extend enum", name, join3(directives, " "), block2(values)], " ")
|
9719
9719
|
},
|
9720
9720
|
InputObjectTypeExtension: {
|
9721
|
-
leave: ({ name, directives, fields }) =>
|
9721
|
+
leave: ({ name, directives, fields }) => join3(["extend input", name, join3(directives, " "), block2(fields)], " ")
|
9722
9722
|
}
|
9723
9723
|
};
|
9724
|
-
function
|
9724
|
+
function join3(maybeArray, separator = "") {
|
9725
9725
|
var _maybeArray$filter$jo;
|
9726
9726
|
return (_maybeArray$filter$jo = maybeArray === null || maybeArray === void 0 ? void 0 : maybeArray.filter((x) => x).join(separator)) !== null && _maybeArray$filter$jo !== void 0 ? _maybeArray$filter$jo : "";
|
9727
9727
|
}
|
9728
9728
|
function block2(array) {
|
9729
|
-
return wrap2("{\n", indent2(
|
9729
|
+
return wrap2("{\n", indent2(join3(array, "\n")), "\n}");
|
9730
9730
|
}
|
9731
9731
|
function wrap2(start, maybeString, end = "") {
|
9732
9732
|
return maybeString != null && maybeString !== "" ? start + maybeString + end : "";
|
@@ -32933,6 +32933,13 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
32933
32933
|
};
|
32934
32934
|
var DateTime = _DateTime;
|
32935
32935
|
__publicField3(DateTime, "TAI64_NULL", "");
|
32936
|
+
function sleep(time) {
|
32937
|
+
return new Promise((resolve) => {
|
32938
|
+
setTimeout(() => {
|
32939
|
+
resolve(true);
|
32940
|
+
}, time);
|
32941
|
+
});
|
32942
|
+
}
|
32936
32943
|
var chainConfig_default = {
|
32937
32944
|
chain_name: "local_testnet",
|
32938
32945
|
consensus_parameters: {
|
@@ -33687,9 +33694,9 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
33687
33694
|
da_block_height: 0
|
33688
33695
|
};
|
33689
33696
|
var defaultSnapshotConfigs = {
|
33690
|
-
|
33691
|
-
|
33692
|
-
|
33697
|
+
chainConfig: chainConfig_default,
|
33698
|
+
metadata: metadata_default,
|
33699
|
+
stateConfig: stateConfig_default
|
33693
33700
|
};
|
33694
33701
|
var defaultConsensusKey = "0xa449b1ffee0e2205fa924c6740cc48b3b473aa28587df6dab12abc245d1f5298";
|
33695
33702
|
function isDefined(value) {
|
@@ -34429,11 +34436,72 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
34429
34436
|
};
|
34430
34437
|
}
|
34431
34438
|
|
34439
|
+
// ../../node_modules/.pnpm/ramda@0.29.0/node_modules/ramda/es/internal/_curry2.js
|
34440
|
+
function _curry2(fn) {
|
34441
|
+
return function f2(a, b) {
|
34442
|
+
switch (arguments.length) {
|
34443
|
+
case 0:
|
34444
|
+
return f2;
|
34445
|
+
case 1:
|
34446
|
+
return _isPlaceholder(a) ? f2 : _curry1(function(_b) {
|
34447
|
+
return fn(a, _b);
|
34448
|
+
});
|
34449
|
+
default:
|
34450
|
+
return _isPlaceholder(a) && _isPlaceholder(b) ? f2 : _isPlaceholder(a) ? _curry1(function(_a) {
|
34451
|
+
return fn(_a, b);
|
34452
|
+
}) : _isPlaceholder(b) ? _curry1(function(_b) {
|
34453
|
+
return fn(a, _b);
|
34454
|
+
}) : fn(a, b);
|
34455
|
+
}
|
34456
|
+
};
|
34457
|
+
}
|
34458
|
+
|
34459
|
+
// ../../node_modules/.pnpm/ramda@0.29.0/node_modules/ramda/es/internal/_curry3.js
|
34460
|
+
function _curry3(fn) {
|
34461
|
+
return function f3(a, b, c) {
|
34462
|
+
switch (arguments.length) {
|
34463
|
+
case 0:
|
34464
|
+
return f3;
|
34465
|
+
case 1:
|
34466
|
+
return _isPlaceholder(a) ? f3 : _curry2(function(_b, _c) {
|
34467
|
+
return fn(a, _b, _c);
|
34468
|
+
});
|
34469
|
+
case 2:
|
34470
|
+
return _isPlaceholder(a) && _isPlaceholder(b) ? f3 : _isPlaceholder(a) ? _curry2(function(_a, _c) {
|
34471
|
+
return fn(_a, b, _c);
|
34472
|
+
}) : _isPlaceholder(b) ? _curry2(function(_b, _c) {
|
34473
|
+
return fn(a, _b, _c);
|
34474
|
+
}) : _curry1(function(_c) {
|
34475
|
+
return fn(a, b, _c);
|
34476
|
+
});
|
34477
|
+
default:
|
34478
|
+
return _isPlaceholder(a) && _isPlaceholder(b) && _isPlaceholder(c) ? f3 : _isPlaceholder(a) && _isPlaceholder(b) ? _curry2(function(_a, _b) {
|
34479
|
+
return fn(_a, _b, c);
|
34480
|
+
}) : _isPlaceholder(a) && _isPlaceholder(c) ? _curry2(function(_a, _c) {
|
34481
|
+
return fn(_a, b, _c);
|
34482
|
+
}) : _isPlaceholder(b) && _isPlaceholder(c) ? _curry2(function(_b, _c) {
|
34483
|
+
return fn(a, _b, _c);
|
34484
|
+
}) : _isPlaceholder(a) ? _curry1(function(_a) {
|
34485
|
+
return fn(_a, b, c);
|
34486
|
+
}) : _isPlaceholder(b) ? _curry1(function(_b) {
|
34487
|
+
return fn(a, _b, c);
|
34488
|
+
}) : _isPlaceholder(c) ? _curry1(function(_c) {
|
34489
|
+
return fn(a, b, _c);
|
34490
|
+
}) : fn(a, b, c);
|
34491
|
+
}
|
34492
|
+
};
|
34493
|
+
}
|
34494
|
+
|
34432
34495
|
// ../../node_modules/.pnpm/ramda@0.29.0/node_modules/ramda/es/internal/_isArray.js
|
34433
34496
|
var isArray_default = Array.isArray || function _isArray(val) {
|
34434
34497
|
return val != null && val.length >= 0 && Object.prototype.toString.call(val) === "[object Array]";
|
34435
34498
|
};
|
34436
34499
|
|
34500
|
+
// ../../node_modules/.pnpm/ramda@0.29.0/node_modules/ramda/es/internal/_has.js
|
34501
|
+
function _has(prop, obj) {
|
34502
|
+
return Object.prototype.hasOwnProperty.call(obj, prop);
|
34503
|
+
}
|
34504
|
+
|
34437
34505
|
// ../../node_modules/.pnpm/ramda@0.29.0/node_modules/ramda/es/type.js
|
34438
34506
|
var type = /* @__PURE__ */ _curry1(function type2(val) {
|
34439
34507
|
return val === null ? "Null" : val === void 0 ? "Undefined" : Object.prototype.toString.call(val).slice(8, -1);
|
@@ -34450,6 +34518,11 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
34450
34518
|
return d.getUTCFullYear() + "-" + pad(d.getUTCMonth() + 1) + "-" + pad(d.getUTCDate()) + "T" + pad(d.getUTCHours()) + ":" + pad(d.getUTCMinutes()) + ":" + pad(d.getUTCSeconds()) + "." + (d.getUTCMilliseconds() / 1e3).toFixed(3).slice(2, 5) + "Z";
|
34451
34519
|
};
|
34452
34520
|
|
34521
|
+
// ../../node_modules/.pnpm/ramda@0.29.0/node_modules/ramda/es/internal/_isObject.js
|
34522
|
+
function _isObject(x) {
|
34523
|
+
return Object.prototype.toString.call(x) === "[object Object]";
|
34524
|
+
}
|
34525
|
+
|
34453
34526
|
// ../../node_modules/.pnpm/ramda@0.29.0/node_modules/ramda/es/internal/_isInteger.js
|
34454
34527
|
var isInteger_default = Number.isInteger || function _isInteger(n) {
|
34455
34528
|
return n << 0 === n;
|
@@ -34563,6 +34636,46 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
34563
34636
|
});
|
34564
34637
|
var clone_default = clone;
|
34565
34638
|
|
34639
|
+
// ../../node_modules/.pnpm/ramda@0.29.0/node_modules/ramda/es/mergeWithKey.js
|
34640
|
+
var mergeWithKey = /* @__PURE__ */ _curry3(function mergeWithKey2(fn, l, r) {
|
34641
|
+
var result = {};
|
34642
|
+
var k;
|
34643
|
+
l = l || {};
|
34644
|
+
r = r || {};
|
34645
|
+
for (k in l) {
|
34646
|
+
if (_has(k, l)) {
|
34647
|
+
result[k] = _has(k, r) ? fn(k, l[k], r[k]) : l[k];
|
34648
|
+
}
|
34649
|
+
}
|
34650
|
+
for (k in r) {
|
34651
|
+
if (_has(k, r) && !_has(k, result)) {
|
34652
|
+
result[k] = r[k];
|
34653
|
+
}
|
34654
|
+
}
|
34655
|
+
return result;
|
34656
|
+
});
|
34657
|
+
var mergeWithKey_default = mergeWithKey;
|
34658
|
+
|
34659
|
+
// ../../node_modules/.pnpm/ramda@0.29.0/node_modules/ramda/es/mergeDeepWithKey.js
|
34660
|
+
var mergeDeepWithKey = /* @__PURE__ */ _curry3(function mergeDeepWithKey2(fn, lObj, rObj) {
|
34661
|
+
return mergeWithKey_default(function(k, lVal, rVal) {
|
34662
|
+
if (_isObject(lVal) && _isObject(rVal)) {
|
34663
|
+
return mergeDeepWithKey2(fn, lVal, rVal);
|
34664
|
+
} else {
|
34665
|
+
return fn(k, lVal, rVal);
|
34666
|
+
}
|
34667
|
+
}, lObj, rObj);
|
34668
|
+
});
|
34669
|
+
var mergeDeepWithKey_default = mergeDeepWithKey;
|
34670
|
+
|
34671
|
+
// ../../node_modules/.pnpm/ramda@0.29.0/node_modules/ramda/es/mergeDeepRight.js
|
34672
|
+
var mergeDeepRight = /* @__PURE__ */ _curry2(function mergeDeepRight2(lObj, rObj) {
|
34673
|
+
return mergeDeepWithKey_default(function(k, lVal, rVal) {
|
34674
|
+
return rVal;
|
34675
|
+
}, lObj, rObj);
|
34676
|
+
});
|
34677
|
+
var mergeDeepRight_default = mergeDeepRight;
|
34678
|
+
|
34566
34679
|
// ../../node_modules/.pnpm/ramda@0.29.0/node_modules/ramda/es/trim.js
|
34567
34680
|
var hasProtoTrim = typeof String.prototype.trim === "function";
|
34568
34681
|
|
@@ -41970,15 +42083,6 @@ ${MessageCoinFragmentDoc}`;
|
|
41970
42083
|
return normalize2(clone_default(root));
|
41971
42084
|
}
|
41972
42085
|
|
41973
|
-
// src/providers/utils/sleep.ts
|
41974
|
-
function sleep(time) {
|
41975
|
-
return new Promise((resolve) => {
|
41976
|
-
setTimeout(() => {
|
41977
|
-
resolve(true);
|
41978
|
-
}, time);
|
41979
|
-
});
|
41980
|
-
}
|
41981
|
-
|
41982
42086
|
// src/providers/utils/extract-tx-error.ts
|
41983
42087
|
var assemblePanicError = (statusReason) => {
|
41984
42088
|
let errorMessage = `The transaction reverted with reason: "${statusReason}".`;
|
@@ -49949,12 +50053,27 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
49949
50053
|
return wallet;
|
49950
50054
|
};
|
49951
50055
|
|
50056
|
+
// ../utils/dist/cli-utils.mjs
|
50057
|
+
var import_fs = __require("fs");
|
50058
|
+
var import_path7 = __require("path");
|
50059
|
+
var findBinPath = (binCommandName, startingDir) => {
|
50060
|
+
const cmdPath = (0, import_path7.join)(startingDir, "node_modules", ".bin", binCommandName);
|
50061
|
+
const parentDir = (0, import_path7.join)(startingDir, "..");
|
50062
|
+
if ((0, import_fs.existsSync)(cmdPath)) {
|
50063
|
+
return cmdPath;
|
50064
|
+
}
|
50065
|
+
if (parentDir === startingDir) {
|
50066
|
+
throw new Error(`Command not found: ${binCommandName}`);
|
50067
|
+
}
|
50068
|
+
return findBinPath(binCommandName, parentDir);
|
50069
|
+
};
|
50070
|
+
|
49952
50071
|
// src/test-utils/launchNode.ts
|
49953
50072
|
var import_child_process = __require("child_process");
|
49954
50073
|
var import_crypto19 = __require("crypto");
|
49955
|
-
var
|
50074
|
+
var import_fs2 = __require("fs");
|
49956
50075
|
var import_os = __toESM(__require("os"));
|
49957
|
-
var
|
50076
|
+
var import_path8 = __toESM(__require("path"));
|
49958
50077
|
var import_portfinder = __toESM(require_portfinder());
|
49959
50078
|
var import_tree_kill = __toESM(require_tree_kill());
|
49960
50079
|
var getFlagValueFromArgs = (args, flag) => {
|
@@ -49983,19 +50102,54 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
49983
50102
|
}
|
49984
50103
|
child.stdout.removeAllListeners();
|
49985
50104
|
child.stderr.removeAllListeners();
|
49986
|
-
if ((0,
|
49987
|
-
(0,
|
50105
|
+
if ((0, import_fs2.existsSync)(configPath)) {
|
50106
|
+
(0, import_fs2.rmSync)(configPath, { recursive: true });
|
49988
50107
|
}
|
49989
50108
|
}
|
49990
50109
|
};
|
50110
|
+
function getFinalStateConfigJSON({ stateConfig, chainConfig }) {
|
50111
|
+
const defaultCoins = defaultSnapshotConfigs.stateConfig.coins.map((coin) => ({
|
50112
|
+
...coin,
|
50113
|
+
amount: "18446744073709551615"
|
50114
|
+
}));
|
50115
|
+
const defaultMessages = defaultSnapshotConfigs.stateConfig.messages.map((message) => ({
|
50116
|
+
...message,
|
50117
|
+
amount: "18446744073709551615"
|
50118
|
+
}));
|
50119
|
+
const coins = defaultCoins.concat(stateConfig.coins.map((coin) => ({ ...coin, amount: coin.amount.toString() }))).filter((coin, index, self2) => self2.findIndex((c) => c.tx_id === coin.tx_id) === index);
|
50120
|
+
const messages = defaultMessages.concat(stateConfig.messages.map((msg) => ({ ...msg, amount: msg.amount.toString() }))).filter((msg, index, self2) => self2.findIndex((m) => m.nonce === msg.nonce) === index);
|
50121
|
+
if (!process.env.GENESIS_SECRET) {
|
50122
|
+
const pk = Signer.generatePrivateKey();
|
50123
|
+
const signer = new Signer(pk);
|
50124
|
+
process.env.GENESIS_SECRET = hexlify(pk);
|
50125
|
+
coins.push({
|
50126
|
+
tx_id: hexlify(randomBytes22(UTXO_ID_LEN)),
|
50127
|
+
owner: signer.address.toHexString(),
|
50128
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
50129
|
+
amount: "18446744073709551615",
|
50130
|
+
asset_id: chainConfig.consensus_parameters.V1.base_asset_id,
|
50131
|
+
output_index: 0,
|
50132
|
+
tx_pointer_block_height: 0,
|
50133
|
+
tx_pointer_tx_idx: 0
|
50134
|
+
});
|
50135
|
+
}
|
50136
|
+
const json = JSON.stringify({
|
50137
|
+
...stateConfig,
|
50138
|
+
coins,
|
50139
|
+
messages
|
50140
|
+
});
|
50141
|
+
const regexMakeNumber = /("amount":)"(\d+)"/gm;
|
50142
|
+
return json.replace(regexMakeNumber, "$1$2");
|
50143
|
+
}
|
49991
50144
|
var launchNode = async ({
|
49992
50145
|
ip,
|
49993
50146
|
port,
|
49994
50147
|
args = [],
|
49995
|
-
|
50148
|
+
useSystemFuelCore = false,
|
49996
50149
|
loggingEnabled = true,
|
49997
50150
|
debugEnabled = false,
|
49998
|
-
basePath
|
50151
|
+
basePath,
|
50152
|
+
snapshotConfig = defaultSnapshotConfigs
|
49999
50153
|
}) => (
|
50000
50154
|
// eslint-disable-next-line no-async-promise-executor
|
50001
50155
|
new Promise(async (resolve, reject) => {
|
@@ -50012,7 +50166,8 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
50012
50166
|
const poaInstantFlagValue = getFlagValueFromArgs(args, "--poa-instant");
|
50013
50167
|
const poaInstant = poaInstantFlagValue === "true" || poaInstantFlagValue === void 0;
|
50014
50168
|
const graphQLStartSubstring = "Binding GraphQL provider to";
|
50015
|
-
const
|
50169
|
+
const binPath = findBinPath("fuels-core", __dirname);
|
50170
|
+
const command = useSystemFuelCore ? "fuel-core" : binPath;
|
50016
50171
|
const ipToUse = ip || "0.0.0.0";
|
50017
50172
|
const portToUse = port || (await (0, import_portfinder.getPortPromise)({
|
50018
50173
|
port: 4e3,
|
@@ -50023,56 +50178,23 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
50023
50178
|
let snapshotDirToUse;
|
50024
50179
|
const prefix = basePath || import_os.default.tmpdir();
|
50025
50180
|
const suffix = basePath ? "" : (0, import_crypto19.randomUUID)();
|
50026
|
-
const
|
50181
|
+
const tempDir = import_path8.default.join(prefix, ".fuels", suffix, "snapshotDir");
|
50027
50182
|
if (snapshotDir) {
|
50028
50183
|
snapshotDirToUse = snapshotDir;
|
50029
50184
|
} else {
|
50030
|
-
if (!(0,
|
50031
|
-
(0,
|
50032
|
-
}
|
50033
|
-
|
50034
|
-
const
|
50035
|
-
|
50036
|
-
|
50037
|
-
|
50038
|
-
|
50039
|
-
|
50040
|
-
|
50041
|
-
|
50042
|
-
|
50043
|
-
messages: stateConfigJson.messages.map((message) => ({
|
50044
|
-
...message,
|
50045
|
-
amount: "18446744073709551615"
|
50046
|
-
}))
|
50047
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
50048
|
-
};
|
50049
|
-
if (!process.env.GENESIS_SECRET) {
|
50050
|
-
const pk = Signer.generatePrivateKey();
|
50051
|
-
const signer = new Signer(pk);
|
50052
|
-
process.env.GENESIS_SECRET = hexlify(pk);
|
50053
|
-
stateConfigJson.coins.push({
|
50054
|
-
tx_id: hexlify(randomBytes22(UTXO_ID_LEN)),
|
50055
|
-
owner: signer.address.toHexString(),
|
50056
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
50057
|
-
amount: "18446744073709551615",
|
50058
|
-
asset_id: chainConfigJson.consensus_parameters.V1.base_asset_id,
|
50059
|
-
output_index: 0,
|
50060
|
-
tx_pointer_block_height: 0,
|
50061
|
-
tx_pointer_tx_idx: 0
|
50062
|
-
});
|
50063
|
-
}
|
50064
|
-
let fixedStateConfigJSON = JSON.stringify(stateConfigJson);
|
50065
|
-
const regexMakeNumber = /("amount":)"(\d+)"/gm;
|
50066
|
-
fixedStateConfigJSON = fixedStateConfigJSON.replace(regexMakeNumber, "$1$2");
|
50067
|
-
const chainConfigWritePath = import_path7.default.join(tempDirPath, "chainConfig.json");
|
50068
|
-
const stateConfigWritePath = import_path7.default.join(tempDirPath, "stateConfig.json");
|
50069
|
-
const metadataWritePath = import_path7.default.join(tempDirPath, "metadata.json");
|
50070
|
-
const stateTransitionWritePath = import_path7.default.join(tempDirPath, "state_transition_bytecode.wasm");
|
50071
|
-
(0, import_fs.writeFileSync)(chainConfigWritePath, JSON.stringify(chainConfigJson), "utf8");
|
50072
|
-
(0, import_fs.writeFileSync)(stateConfigWritePath, fixedStateConfigJSON, "utf8");
|
50073
|
-
(0, import_fs.writeFileSync)(metadataWritePath, JSON.stringify(metadataJson), "utf8");
|
50074
|
-
(0, import_fs.writeFileSync)(stateTransitionWritePath, JSON.stringify(""));
|
50075
|
-
snapshotDirToUse = tempDirPath;
|
50185
|
+
if (!(0, import_fs2.existsSync)(tempDir)) {
|
50186
|
+
(0, import_fs2.mkdirSync)(tempDir, { recursive: true });
|
50187
|
+
}
|
50188
|
+
const { metadata } = snapshotConfig;
|
50189
|
+
const metadataPath = import_path8.default.join(tempDir, "metadata.json");
|
50190
|
+
const chainConfigPath = import_path8.default.join(tempDir, metadata.chain_config);
|
50191
|
+
const stateConfigPath = import_path8.default.join(tempDir, metadata.table_encoding.Json.filepath);
|
50192
|
+
const stateTransitionPath = import_path8.default.join(tempDir, "state_transition_bytecode.wasm");
|
50193
|
+
(0, import_fs2.writeFileSync)(chainConfigPath, JSON.stringify(snapshotConfig.chainConfig), "utf8");
|
50194
|
+
(0, import_fs2.writeFileSync)(stateConfigPath, getFinalStateConfigJSON(snapshotConfig), "utf8");
|
50195
|
+
(0, import_fs2.writeFileSync)(metadataPath, JSON.stringify(metadata), "utf8");
|
50196
|
+
(0, import_fs2.writeFileSync)(stateTransitionPath, JSON.stringify(""));
|
50197
|
+
snapshotDirToUse = tempDir;
|
50076
50198
|
}
|
50077
50199
|
const child = (0, import_child_process.spawn)(
|
50078
50200
|
command,
|
@@ -50080,7 +50202,7 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
50080
50202
|
"run",
|
50081
50203
|
["--ip", ipToUse],
|
50082
50204
|
["--port", portToUse],
|
50083
|
-
useInMemoryDb ? ["--db-type", "in-memory"] : ["--db-path",
|
50205
|
+
useInMemoryDb ? ["--db-type", "in-memory"] : ["--db-path", tempDir],
|
50084
50206
|
["--min-gas-price", "1"],
|
50085
50207
|
poaInstant ? ["--poa-instant", "true"] : [],
|
50086
50208
|
["--consensus-key", consensusKey],
|
@@ -50102,23 +50224,28 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
50102
50224
|
}
|
50103
50225
|
const cleanupConfig = {
|
50104
50226
|
child,
|
50105
|
-
configPath:
|
50227
|
+
configPath: tempDir,
|
50106
50228
|
killFn: import_tree_kill.default,
|
50107
50229
|
state: {
|
50108
50230
|
isDead: false
|
50109
50231
|
}
|
50110
50232
|
};
|
50111
50233
|
child.stderr.on("data", (chunk) => {
|
50112
|
-
|
50234
|
+
const text = typeof chunk === "string" ? chunk : chunk.toString();
|
50235
|
+
if (text.indexOf(graphQLStartSubstring) !== -1) {
|
50236
|
+
const rows = text.split("\n");
|
50237
|
+
const rowWithUrl = rows.find((row) => row.indexOf(graphQLStartSubstring) !== -1);
|
50238
|
+
const [realIp, realPort] = rowWithUrl.split(" ").at(-1).trim().split(":");
|
50113
50239
|
resolve({
|
50114
50240
|
cleanup: () => killNode(cleanupConfig),
|
50115
|
-
ip:
|
50116
|
-
port:
|
50241
|
+
ip: realIp,
|
50242
|
+
port: realPort,
|
50243
|
+
url: `http://${realIp}:${realPort}/v1/graphql`,
|
50117
50244
|
snapshotDir: snapshotDirToUse
|
50118
50245
|
});
|
50119
50246
|
}
|
50120
|
-
if (/error/i.test(
|
50121
|
-
reject(
|
50247
|
+
if (/error/i.test(text)) {
|
50248
|
+
reject(text.toString());
|
50122
50249
|
}
|
50123
50250
|
});
|
50124
50251
|
process.on("exit", () => killNode(cleanupConfig));
|
@@ -50151,6 +50278,222 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
50151
50278
|
};
|
50152
50279
|
return { wallets, stop: cleanup, provider };
|
50153
50280
|
};
|
50281
|
+
|
50282
|
+
// src/test-utils/asset-id.ts
|
50283
|
+
var _AssetId = class {
|
50284
|
+
constructor(value) {
|
50285
|
+
this.value = value;
|
50286
|
+
}
|
50287
|
+
static random(count = 1) {
|
50288
|
+
const assetIds = [];
|
50289
|
+
for (let i = 0; i < count; i++) {
|
50290
|
+
assetIds.push(new _AssetId(hexlify(randomBytes22(32))));
|
50291
|
+
}
|
50292
|
+
return assetIds;
|
50293
|
+
}
|
50294
|
+
};
|
50295
|
+
var AssetId = _AssetId;
|
50296
|
+
__publicField(AssetId, "A", new _AssetId(
|
50297
|
+
"0x0101010101010101010101010101010101010101010101010101010101010101"
|
50298
|
+
));
|
50299
|
+
__publicField(AssetId, "B", new _AssetId(
|
50300
|
+
"0x0202020202020202020202020202020202020202020202020202020202020202"
|
50301
|
+
));
|
50302
|
+
|
50303
|
+
// src/test-utils/wallet-config.ts
|
50304
|
+
var WalletConfig = class {
|
50305
|
+
initialState;
|
50306
|
+
options;
|
50307
|
+
wallets;
|
50308
|
+
generateWallets = () => {
|
50309
|
+
const generatedWallets = [];
|
50310
|
+
for (let index = 1; index <= this.options.count; index++) {
|
50311
|
+
generatedWallets.push(new WalletUnlocked(randomBytes22(32)));
|
50312
|
+
}
|
50313
|
+
return generatedWallets;
|
50314
|
+
};
|
50315
|
+
constructor(baseAssetId, config) {
|
50316
|
+
WalletConfig.validate(config);
|
50317
|
+
this.options = config;
|
50318
|
+
const { assets: assets2, coinsPerAsset, amountPerCoin, messages } = this.options;
|
50319
|
+
this.wallets = this.generateWallets();
|
50320
|
+
this.initialState = {
|
50321
|
+
messages: WalletConfig.createMessages(this.wallets, messages),
|
50322
|
+
coins: WalletConfig.createCoins(
|
50323
|
+
this.wallets,
|
50324
|
+
baseAssetId,
|
50325
|
+
assets2,
|
50326
|
+
coinsPerAsset,
|
50327
|
+
amountPerCoin
|
50328
|
+
)
|
50329
|
+
};
|
50330
|
+
}
|
50331
|
+
apply(snapshotConfig) {
|
50332
|
+
return {
|
50333
|
+
...snapshotConfig,
|
50334
|
+
stateConfig: {
|
50335
|
+
...snapshotConfig?.stateConfig ?? defaultSnapshotConfigs.stateConfig,
|
50336
|
+
coins: this.initialState.coins.concat(snapshotConfig?.stateConfig?.coins || []),
|
50337
|
+
messages: this.initialState.messages.concat(snapshotConfig?.stateConfig?.messages ?? [])
|
50338
|
+
}
|
50339
|
+
};
|
50340
|
+
}
|
50341
|
+
/**
|
50342
|
+
* Create messages for the wallets in the format that the chain expects.
|
50343
|
+
*/
|
50344
|
+
static createMessages(wallets, messages) {
|
50345
|
+
return messages.map((msg) => wallets.map((wallet) => msg.toChainMessage(wallet.address))).flatMap((x) => x);
|
50346
|
+
}
|
50347
|
+
/**
|
50348
|
+
* Create coins for the wallets in the format that the chain expects.
|
50349
|
+
*/
|
50350
|
+
static createCoins(wallets, baseAssetId, assets2, coinsPerAsset, amountPerCoin) {
|
50351
|
+
const coins = [];
|
50352
|
+
let assetIds = [baseAssetId];
|
50353
|
+
if (Array.isArray(assets2)) {
|
50354
|
+
assetIds = assetIds.concat(assets2.map((a) => a.value));
|
50355
|
+
} else {
|
50356
|
+
assetIds.concat(AssetId.random(assets2).map((a) => a.value));
|
50357
|
+
}
|
50358
|
+
wallets.map((wallet) => wallet.address.toHexString()).forEach((walletAddress) => {
|
50359
|
+
assetIds.forEach((assetId) => {
|
50360
|
+
for (let index = 0; index < coinsPerAsset; index++) {
|
50361
|
+
coins.push({
|
50362
|
+
amount: amountPerCoin,
|
50363
|
+
asset_id: assetId,
|
50364
|
+
owner: walletAddress,
|
50365
|
+
tx_pointer_block_height: 0,
|
50366
|
+
tx_pointer_tx_idx: 0,
|
50367
|
+
output_index: 0,
|
50368
|
+
tx_id: hexlify(randomBytes22(32))
|
50369
|
+
});
|
50370
|
+
}
|
50371
|
+
});
|
50372
|
+
});
|
50373
|
+
return coins;
|
50374
|
+
}
|
50375
|
+
static validate({
|
50376
|
+
count: wallets,
|
50377
|
+
assets: assets2,
|
50378
|
+
coinsPerAsset,
|
50379
|
+
amountPerCoin
|
50380
|
+
}) {
|
50381
|
+
if (Array.isArray(wallets) && wallets.length === 0 || typeof wallets === "number" && wallets <= 0) {
|
50382
|
+
throw new FuelError(
|
50383
|
+
FuelError.CODES.INVALID_INPUT_PARAMETERS,
|
50384
|
+
"Number of wallets must be greater than zero."
|
50385
|
+
);
|
50386
|
+
}
|
50387
|
+
if (Array.isArray(assets2) && assets2.length === 0 || typeof assets2 === "number" && assets2 <= 0) {
|
50388
|
+
throw new FuelError(
|
50389
|
+
FuelError.CODES.INVALID_INPUT_PARAMETERS,
|
50390
|
+
"Number of assets per wallet must be greater than zero."
|
50391
|
+
);
|
50392
|
+
}
|
50393
|
+
if (coinsPerAsset <= 0) {
|
50394
|
+
throw new FuelError(
|
50395
|
+
FuelError.CODES.INVALID_INPUT_PARAMETERS,
|
50396
|
+
"Number of coins per asset must be greater than zero."
|
50397
|
+
);
|
50398
|
+
}
|
50399
|
+
if (amountPerCoin <= 0) {
|
50400
|
+
throw new FuelError(
|
50401
|
+
FuelError.CODES.INVALID_INPUT_PARAMETERS,
|
50402
|
+
"Amount per coin must be greater than zero."
|
50403
|
+
);
|
50404
|
+
}
|
50405
|
+
}
|
50406
|
+
};
|
50407
|
+
|
50408
|
+
// src/test-utils/setup-test-provider-and-wallets.ts
|
50409
|
+
var defaultWalletConfigOptions = {
|
50410
|
+
count: 2,
|
50411
|
+
assets: [AssetId.A, AssetId.B],
|
50412
|
+
coinsPerAsset: 1,
|
50413
|
+
amountPerCoin: 1e10,
|
50414
|
+
messages: []
|
50415
|
+
};
|
50416
|
+
async function setupTestProviderAndWallets({
|
50417
|
+
walletConfig: walletConfigOptions = {},
|
50418
|
+
providerOptions,
|
50419
|
+
nodeOptions = {}
|
50420
|
+
} = {}) {
|
50421
|
+
Symbol.dispose ??= Symbol("Symbol.dispose");
|
50422
|
+
const walletConfig = new WalletConfig(
|
50423
|
+
nodeOptions.snapshotConfig?.chainConfig?.consensus_parameters?.V1?.base_asset_id ?? defaultSnapshotConfigs.chainConfig.consensus_parameters.V1.base_asset_id,
|
50424
|
+
{
|
50425
|
+
...defaultWalletConfigOptions,
|
50426
|
+
...walletConfigOptions
|
50427
|
+
}
|
50428
|
+
);
|
50429
|
+
const { cleanup, url } = await launchNode({
|
50430
|
+
loggingEnabled: false,
|
50431
|
+
...nodeOptions,
|
50432
|
+
snapshotConfig: mergeDeepRight_default(
|
50433
|
+
defaultSnapshotConfigs,
|
50434
|
+
walletConfig.apply(nodeOptions?.snapshotConfig)
|
50435
|
+
),
|
50436
|
+
port: "0"
|
50437
|
+
});
|
50438
|
+
let provider;
|
50439
|
+
try {
|
50440
|
+
provider = await Provider.create(url, providerOptions);
|
50441
|
+
} catch (err) {
|
50442
|
+
cleanup();
|
50443
|
+
throw err;
|
50444
|
+
}
|
50445
|
+
const wallets = walletConfig.wallets;
|
50446
|
+
wallets.forEach((wallet) => {
|
50447
|
+
wallet.connect(provider);
|
50448
|
+
});
|
50449
|
+
return {
|
50450
|
+
provider,
|
50451
|
+
wallets,
|
50452
|
+
cleanup,
|
50453
|
+
[Symbol.dispose]: cleanup
|
50454
|
+
};
|
50455
|
+
}
|
50456
|
+
|
50457
|
+
// src/test-utils/test-message.ts
|
50458
|
+
var TestMessage = class {
|
50459
|
+
sender;
|
50460
|
+
recipient;
|
50461
|
+
nonce;
|
50462
|
+
amount;
|
50463
|
+
data;
|
50464
|
+
da_height;
|
50465
|
+
/**
|
50466
|
+
* A helper class to create messages for testing purposes.
|
50467
|
+
*
|
50468
|
+
* Used in tandem with `WalletConfig`.
|
50469
|
+
* It can also be used standalone and passed into the initial state of a chain via the `.toChainMessage` method.
|
50470
|
+
*/
|
50471
|
+
constructor({
|
50472
|
+
sender = Address.fromRandom(),
|
50473
|
+
recipient = Address.fromRandom(),
|
50474
|
+
nonce = hexlify(randomBytes22(32)),
|
50475
|
+
amount = 1e6,
|
50476
|
+
data = "02",
|
50477
|
+
da_height = 0
|
50478
|
+
} = {}) {
|
50479
|
+
this.sender = sender;
|
50480
|
+
this.recipient = recipient;
|
50481
|
+
this.nonce = nonce;
|
50482
|
+
this.amount = amount;
|
50483
|
+
this.data = data;
|
50484
|
+
this.da_height = da_height;
|
50485
|
+
}
|
50486
|
+
toChainMessage(recipient) {
|
50487
|
+
return {
|
50488
|
+
sender: this.sender.toB256(),
|
50489
|
+
recipient: recipient?.toB256() ?? this.recipient.toB256(),
|
50490
|
+
nonce: this.nonce,
|
50491
|
+
amount: bn(this.amount).toNumber(),
|
50492
|
+
data: this.data,
|
50493
|
+
da_height: this.da_height
|
50494
|
+
};
|
50495
|
+
}
|
50496
|
+
};
|
50154
50497
|
})();
|
50155
50498
|
/*! Bundled license information:
|
50156
50499
|
|