@fuel-ts/account 0.0.0-rc-1356-20240520140225 → 0.0.0-rc-2143-20240520152005
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 +9 -7
- package/dist/index.global.js.map +1 -1
- package/dist/index.js +125 -115
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +10 -1
- 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 +1 -0
- package/dist/providers/utils/index.d.ts.map +1 -1
- package/dist/providers/utils/sleep.d.ts +3 -0
- package/dist/providers/utils/sleep.d.ts.map +1 -0
- package/dist/test-utils/index.d.ts +0 -4
- package/dist/test-utils/index.d.ts.map +1 -1
- package/dist/test-utils/launchNode.d.ts +3 -10
- package/dist/test-utils/launchNode.d.ts.map +1 -1
- package/dist/test-utils.global.js +122 -465
- package/dist/test-utils.global.js.map +1 -1
- package/dist/test-utils.js +169 -407
- package/dist/test-utils.js.map +1 -1
- package/dist/test-utils.mjs +67 -301
- package/dist/test-utils.mjs.map +1 -1
- package/package.json +15 -16
- package/dist/test-utils/asset-id.d.ts +0 -8
- package/dist/test-utils/asset-id.d.ts.map +0 -1
- package/dist/test-utils/setup-test-provider-and-wallets.d.ts +0 -33
- package/dist/test-utils/setup-test-provider-and-wallets.d.ts.map +0 -1
- package/dist/test-utils/test-message.d.ts +0 -29
- package/dist/test-utils/test-message.d.ts.map +0 -1
- package/dist/test-utils/wallet-config.d.ts +0 -55
- package/dist/test-utils/wallet-config.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) => join2(node.definitions, "\n\n")
|
9515
9515
|
},
|
9516
9516
|
OperationDefinition: {
|
9517
9517
|
leave(node) {
|
9518
|
-
const varDefs = wrap2("(",
|
9519
|
-
const prefix =
|
9518
|
+
const varDefs = wrap2("(", join2(node.variableDefinitions, ", "), ")");
|
9519
|
+
const prefix = join2(
|
9520
9520
|
[
|
9521
9521
|
node.operation,
|
9522
|
-
|
9523
|
-
|
9522
|
+
join2([node.name, varDefs]),
|
9523
|
+
join2(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(" ", join2(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("(", join2(args, ", "), ")");
|
9540
9540
|
if (argsLine.length > MAX_LINE_LENGTH2) {
|
9541
|
-
argsLine = prefix + wrap2("(\n", indent2(
|
9541
|
+
argsLine = prefix + wrap2("(\n", indent2(join2(args, "\n")), "\n)");
|
9542
9542
|
}
|
9543
|
-
return
|
9543
|
+
return join2([argsLine, join2(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(" ", join2(directives, " "))
|
9552
9552
|
},
|
9553
9553
|
InlineFragment: {
|
9554
|
-
leave: ({ typeCondition, directives, selectionSet }) =>
|
9554
|
+
leave: ({ typeCondition, directives, selectionSet }) => join2(
|
9555
9555
|
[
|
9556
9556
|
"...",
|
9557
9557
|
wrap2("on ", typeCondition),
|
9558
|
-
|
9558
|
+
join2(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("(", join2(variableDefinitions, ", "), ")")} on ${typeCondition} ${wrap2("", join2(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 }) => "[" + join2(values, ", ") + "]"
|
9591
9591
|
},
|
9592
9592
|
ObjectValue: {
|
9593
|
-
leave: ({ fields }) => "{" +
|
9593
|
+
leave: ({ fields }) => "{" + join2(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("(", join2(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") + join2(["schema", join2(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") + join2(["scalar", name, join2(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") + join2(
|
9624
9624
|
[
|
9625
9625
|
"type",
|
9626
9626
|
name,
|
9627
|
-
wrap2("implements ",
|
9628
|
-
|
9627
|
+
wrap2("implements ", join2(interfaces, " & ")),
|
9628
|
+
join2(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(join2(args, "\n")), "\n)") : wrap2("(", join2(args, ", "), ")")) + ": " + type3 + wrap2(" ", join2(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") + join2(
|
9639
|
+
[name + ": " + type3, wrap2("= ", defaultValue), join2(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") + join2(
|
9645
9645
|
[
|
9646
9646
|
"interface",
|
9647
9647
|
name,
|
9648
|
-
wrap2("implements ",
|
9649
|
-
|
9648
|
+
wrap2("implements ", join2(interfaces, " & ")),
|
9649
|
+
join2(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") + join2(
|
9657
|
+
["union", name, join2(directives, " "), wrap2("= ", join2(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") + join2(["enum", name, join2(directives, " "), block2(values)], " ")
|
9663
9663
|
},
|
9664
9664
|
EnumValueDefinition: {
|
9665
|
-
leave: ({ description, name, directives }) => wrap2("", description, "\n") +
|
9665
|
+
leave: ({ description, name, directives }) => wrap2("", description, "\n") + join2([name, join2(directives, " ")], " ")
|
9666
9666
|
},
|
9667
9667
|
InputObjectTypeDefinition: {
|
9668
|
-
leave: ({ description, name, directives, fields }) => wrap2("", description, "\n") +
|
9668
|
+
leave: ({ description, name, directives, fields }) => wrap2("", description, "\n") + join2(["input", name, join2(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(join2(args, "\n")), "\n)") : wrap2("(", join2(args, ", "), ")")) + (repeatable ? " repeatable" : "") + " on " + join2(locations, " | ")
|
9672
9672
|
},
|
9673
9673
|
SchemaExtension: {
|
9674
|
-
leave: ({ directives, operationTypes }) =>
|
9675
|
-
["extend schema",
|
9674
|
+
leave: ({ directives, operationTypes }) => join2(
|
9675
|
+
["extend schema", join2(directives, " "), block2(operationTypes)],
|
9676
9676
|
" "
|
9677
9677
|
)
|
9678
9678
|
},
|
9679
9679
|
ScalarTypeExtension: {
|
9680
|
-
leave: ({ name, directives }) =>
|
9680
|
+
leave: ({ name, directives }) => join2(["extend scalar", name, join2(directives, " ")], " ")
|
9681
9681
|
},
|
9682
9682
|
ObjectTypeExtension: {
|
9683
|
-
leave: ({ name, interfaces, directives, fields }) =>
|
9683
|
+
leave: ({ name, interfaces, directives, fields }) => join2(
|
9684
9684
|
[
|
9685
9685
|
"extend type",
|
9686
9686
|
name,
|
9687
|
-
wrap2("implements ",
|
9688
|
-
|
9687
|
+
wrap2("implements ", join2(interfaces, " & ")),
|
9688
|
+
join2(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 }) => join2(
|
9696
9696
|
[
|
9697
9697
|
"extend interface",
|
9698
9698
|
name,
|
9699
|
-
wrap2("implements ",
|
9700
|
-
|
9699
|
+
wrap2("implements ", join2(interfaces, " & ")),
|
9700
|
+
join2(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 }) => join2(
|
9708
9708
|
[
|
9709
9709
|
"extend union",
|
9710
9710
|
name,
|
9711
|
-
|
9712
|
-
wrap2("= ",
|
9711
|
+
join2(directives, " "),
|
9712
|
+
wrap2("= ", join2(types, " | "))
|
9713
9713
|
],
|
9714
9714
|
" "
|
9715
9715
|
)
|
9716
9716
|
},
|
9717
9717
|
EnumTypeExtension: {
|
9718
|
-
leave: ({ name, directives, values }) =>
|
9718
|
+
leave: ({ name, directives, values }) => join2(["extend enum", name, join2(directives, " "), block2(values)], " ")
|
9719
9719
|
},
|
9720
9720
|
InputObjectTypeExtension: {
|
9721
|
-
leave: ({ name, directives, fields }) =>
|
9721
|
+
leave: ({ name, directives, fields }) => join2(["extend input", name, join2(directives, " "), block2(fields)], " ")
|
9722
9722
|
}
|
9723
9723
|
};
|
9724
|
-
function
|
9724
|
+
function join2(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(join2(array, "\n")), "\n}");
|
9730
9730
|
}
|
9731
9731
|
function wrap2(start, maybeString, end = "") {
|
9732
9732
|
return maybeString != null && maybeString !== "" ? start + maybeString + end : "";
|
@@ -32933,13 +32933,6 @@ 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
|
-
}
|
32943
32936
|
var chainConfig_default = {
|
32944
32937
|
chain_name: "local_testnet",
|
32945
32938
|
consensus_parameters: {
|
@@ -33694,9 +33687,9 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
33694
33687
|
da_block_height: 0
|
33695
33688
|
};
|
33696
33689
|
var defaultSnapshotConfigs = {
|
33697
|
-
|
33698
|
-
|
33699
|
-
|
33690
|
+
chainConfigJson: chainConfig_default,
|
33691
|
+
metadataJson: metadata_default,
|
33692
|
+
stateConfigJson: stateConfig_default
|
33700
33693
|
};
|
33701
33694
|
var defaultConsensusKey = "0xa449b1ffee0e2205fa924c6740cc48b3b473aa28587df6dab12abc245d1f5298";
|
33702
33695
|
function isDefined(value) {
|
@@ -34436,72 +34429,11 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
34436
34429
|
};
|
34437
34430
|
}
|
34438
34431
|
|
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
|
-
|
34495
34432
|
// ../../node_modules/.pnpm/ramda@0.29.0/node_modules/ramda/es/internal/_isArray.js
|
34496
34433
|
var isArray_default = Array.isArray || function _isArray(val) {
|
34497
34434
|
return val != null && val.length >= 0 && Object.prototype.toString.call(val) === "[object Array]";
|
34498
34435
|
};
|
34499
34436
|
|
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
|
-
|
34505
34437
|
// ../../node_modules/.pnpm/ramda@0.29.0/node_modules/ramda/es/type.js
|
34506
34438
|
var type = /* @__PURE__ */ _curry1(function type2(val) {
|
34507
34439
|
return val === null ? "Null" : val === void 0 ? "Undefined" : Object.prototype.toString.call(val).slice(8, -1);
|
@@ -34518,11 +34450,6 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
34518
34450
|
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";
|
34519
34451
|
};
|
34520
34452
|
|
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
|
-
|
34526
34453
|
// ../../node_modules/.pnpm/ramda@0.29.0/node_modules/ramda/es/internal/_isInteger.js
|
34527
34454
|
var isInteger_default = Number.isInteger || function _isInteger(n) {
|
34528
34455
|
return n << 0 === n;
|
@@ -34636,46 +34563,6 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
34636
34563
|
});
|
34637
34564
|
var clone_default = clone;
|
34638
34565
|
|
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
|
-
|
34679
34566
|
// ../../node_modules/.pnpm/ramda@0.29.0/node_modules/ramda/es/trim.js
|
34680
34567
|
var hasProtoTrim = typeof String.prototype.trim === "function";
|
34681
34568
|
|
@@ -42083,6 +41970,15 @@ ${MessageCoinFragmentDoc}`;
|
|
42083
41970
|
return normalize2(clone_default(root));
|
42084
41971
|
}
|
42085
41972
|
|
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
|
+
|
42086
41982
|
// src/providers/utils/extract-tx-error.ts
|
42087
41983
|
var assemblePanicError = (statusReason) => {
|
42088
41984
|
let errorMessage = `The transaction reverted with reason: "${statusReason}".`;
|
@@ -50053,27 +49949,12 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
50053
49949
|
return wallet;
|
50054
49950
|
};
|
50055
49951
|
|
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
|
-
|
50071
49952
|
// src/test-utils/launchNode.ts
|
50072
49953
|
var import_child_process = __require("child_process");
|
50073
49954
|
var import_crypto19 = __require("crypto");
|
50074
|
-
var
|
49955
|
+
var import_fs = __require("fs");
|
50075
49956
|
var import_os = __toESM(__require("os"));
|
50076
|
-
var
|
49957
|
+
var import_path7 = __toESM(__require("path"));
|
50077
49958
|
var import_portfinder = __toESM(require_portfinder());
|
50078
49959
|
var import_tree_kill = __toESM(require_tree_kill());
|
50079
49960
|
var getFlagValueFromArgs = (args, flag) => {
|
@@ -50102,54 +49983,19 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
50102
49983
|
}
|
50103
49984
|
child.stdout.removeAllListeners();
|
50104
49985
|
child.stderr.removeAllListeners();
|
50105
|
-
if ((0,
|
50106
|
-
(0,
|
49986
|
+
if ((0, import_fs.existsSync)(configPath)) {
|
49987
|
+
(0, import_fs.rmSync)(configPath, { recursive: true });
|
50107
49988
|
}
|
50108
49989
|
}
|
50109
49990
|
};
|
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
|
-
}
|
50144
49991
|
var launchNode = async ({
|
50145
49992
|
ip,
|
50146
49993
|
port,
|
50147
49994
|
args = [],
|
50148
|
-
|
49995
|
+
fuelCorePath = process.env.FUEL_CORE_PATH ?? void 0,
|
50149
49996
|
loggingEnabled = true,
|
50150
49997
|
debugEnabled = false,
|
50151
|
-
basePath
|
50152
|
-
snapshotConfig = defaultSnapshotConfigs
|
49998
|
+
basePath
|
50153
49999
|
}) => (
|
50154
50000
|
// eslint-disable-next-line no-async-promise-executor
|
50155
50001
|
new Promise(async (resolve, reject) => {
|
@@ -50166,8 +50012,7 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
50166
50012
|
const poaInstantFlagValue = getFlagValueFromArgs(args, "--poa-instant");
|
50167
50013
|
const poaInstant = poaInstantFlagValue === "true" || poaInstantFlagValue === void 0;
|
50168
50014
|
const graphQLStartSubstring = "Binding GraphQL provider to";
|
50169
|
-
const
|
50170
|
-
const command = useSystemFuelCore ? "fuel-core" : binPath;
|
50015
|
+
const command = fuelCorePath ?? "fuel-core";
|
50171
50016
|
const ipToUse = ip || "0.0.0.0";
|
50172
50017
|
const portToUse = port || (await (0, import_portfinder.getPortPromise)({
|
50173
50018
|
port: 4e3,
|
@@ -50178,23 +50023,56 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
50178
50023
|
let snapshotDirToUse;
|
50179
50024
|
const prefix = basePath || import_os.default.tmpdir();
|
50180
50025
|
const suffix = basePath ? "" : (0, import_crypto19.randomUUID)();
|
50181
|
-
const
|
50026
|
+
const tempDirPath = import_path7.default.join(prefix, ".fuels", suffix, "snapshotDir");
|
50182
50027
|
if (snapshotDir) {
|
50183
50028
|
snapshotDirToUse = snapshotDir;
|
50184
50029
|
} else {
|
50185
|
-
if (!(0,
|
50186
|
-
(0,
|
50187
|
-
}
|
50188
|
-
|
50189
|
-
const
|
50190
|
-
|
50191
|
-
|
50192
|
-
|
50193
|
-
|
50194
|
-
|
50195
|
-
|
50196
|
-
|
50197
|
-
|
50030
|
+
if (!(0, import_fs.existsSync)(tempDirPath)) {
|
50031
|
+
(0, import_fs.mkdirSync)(tempDirPath, { recursive: true });
|
50032
|
+
}
|
50033
|
+
let { stateConfigJson } = defaultSnapshotConfigs;
|
50034
|
+
const { chainConfigJson, metadataJson } = defaultSnapshotConfigs;
|
50035
|
+
stateConfigJson = {
|
50036
|
+
...stateConfigJson,
|
50037
|
+
coins: [
|
50038
|
+
...stateConfigJson.coins.map((coin) => ({
|
50039
|
+
...coin,
|
50040
|
+
amount: "18446744073709551615"
|
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;
|
50198
50076
|
}
|
50199
50077
|
const child = (0, import_child_process.spawn)(
|
50200
50078
|
command,
|
@@ -50202,7 +50080,7 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
50202
50080
|
"run",
|
50203
50081
|
["--ip", ipToUse],
|
50204
50082
|
["--port", portToUse],
|
50205
|
-
useInMemoryDb ? ["--db-type", "in-memory"] : ["--db-path",
|
50083
|
+
useInMemoryDb ? ["--db-type", "in-memory"] : ["--db-path", tempDirPath],
|
50206
50084
|
["--min-gas-price", "1"],
|
50207
50085
|
poaInstant ? ["--poa-instant", "true"] : [],
|
50208
50086
|
["--consensus-key", consensusKey],
|
@@ -50224,28 +50102,23 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
50224
50102
|
}
|
50225
50103
|
const cleanupConfig = {
|
50226
50104
|
child,
|
50227
|
-
configPath:
|
50105
|
+
configPath: tempDirPath,
|
50228
50106
|
killFn: import_tree_kill.default,
|
50229
50107
|
state: {
|
50230
50108
|
isDead: false
|
50231
50109
|
}
|
50232
50110
|
};
|
50233
50111
|
child.stderr.on("data", (chunk) => {
|
50234
|
-
|
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(":");
|
50112
|
+
if (chunk.indexOf(graphQLStartSubstring) !== -1) {
|
50239
50113
|
resolve({
|
50240
50114
|
cleanup: () => killNode(cleanupConfig),
|
50241
|
-
ip:
|
50242
|
-
port:
|
50243
|
-
url: `http://${realIp}:${realPort}/v1/graphql`,
|
50115
|
+
ip: ipToUse,
|
50116
|
+
port: portToUse,
|
50244
50117
|
snapshotDir: snapshotDirToUse
|
50245
50118
|
});
|
50246
50119
|
}
|
50247
|
-
if (/error/i.test(
|
50248
|
-
reject(
|
50120
|
+
if (/error/i.test(chunk)) {
|
50121
|
+
reject(chunk.toString());
|
50249
50122
|
}
|
50250
50123
|
});
|
50251
50124
|
process.on("exit", () => killNode(cleanupConfig));
|
@@ -50278,222 +50151,6 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
50278
50151
|
};
|
50279
50152
|
return { wallets, stop: cleanup, provider };
|
50280
50153
|
};
|
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
|
-
};
|
50497
50154
|
})();
|
50498
50155
|
/*! Bundled license information:
|
50499
50156
|
|