@fuel-ts/account 0.0.0-rc-1976-20240415100843 → 0.0.0-rc-2045-20240415152456
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/account.d.ts.map +1 -1
- package/dist/index.global.js +45 -67
- package/dist/index.global.js.map +1 -1
- package/dist/index.js +80 -100
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +42 -62
- package/dist/index.mjs.map +1 -1
- package/dist/predicate/predicate.d.ts.map +1 -1
- package/dist/providers/coin-quantity.d.ts +2 -2
- package/dist/providers/coin-quantity.d.ts.map +1 -1
- package/dist/providers/provider.d.ts +0 -7
- package/dist/providers/provider.d.ts.map +1 -1
- package/dist/providers/transaction-request/create-transaction-request.d.ts +1 -1
- package/dist/providers/transaction-request/create-transaction-request.d.ts.map +1 -1
- package/dist/providers/transaction-request/script-transaction-request.d.ts +1 -1
- package/dist/providers/transaction-request/script-transaction-request.d.ts.map +1 -1
- package/dist/providers/transaction-request/transaction-request.d.ts +2 -5
- package/dist/providers/transaction-request/transaction-request.d.ts.map +1 -1
- package/dist/test-utils/launchNode.d.ts.map +1 -1
- package/dist/test-utils/seedTestWallet.d.ts.map +1 -1
- package/dist/test-utils.global.js +46 -71
- package/dist/test-utils.global.js.map +1 -1
- package/dist/test-utils.js +80 -103
- package/dist/test-utils.js.map +1 -1
- package/dist/test-utils.mjs +42 -65
- package/dist/test-utils.mjs.map +1 -1
- package/package.json +16 -16
package/dist/account.d.ts.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"account.d.ts","sourceRoot":"","sources":["../src/account.ts"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"account.d.ts","sourceRoot":"","sources":["../src/account.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AACtD,OAAO,KAAK,EAAE,eAAe,EAAE,SAAS,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B,MAAM,EAAE,YAAY;IACpB,gBAAgB;IAChB,QAAQ,GAAE,YAAiB,GAC1B,OAAO,CAAC,mBAAmB,CAAC;IAyCzB,WAAW,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAOnD;;;;;OAKG;IACG,eAAe,CAAC,sBAAsB,EAAE,sBAAsB,GAAG,OAAO,CAAC,MAAM,CAAC;IAUtF;;;;;OAKG;IACG,eAAe,CACnB,sBAAsB,EAAE,sBAAsB,EAC9C,EAAE,sBAA6B,EAAE,cAAc,EAAE,GAAE,oBAAyB,GAC3E,OAAO,CAAC,mBAAmB,CAAC;IAgB/B;;;;;OAKG;IACG,mBAAmB,CACvB,sBAAsB,EAAE,sBAAsB,EAC9C,EAAE,sBAA6B,EAAE,GAAE,yBAA8B,GAChE,OAAO,CAAC,UAAU,CAAC;IAQtB,OAAO,CAAC,WAAW;CAyBpB"}
|
package/dist/index.global.js
CHANGED
@@ -28952,7 +28952,7 @@ spurious results.`);
|
|
28952
28952
|
// ../versions/dist/index.mjs
|
28953
28953
|
function getBuiltinVersions() {
|
28954
28954
|
return {
|
28955
|
-
FORC: "0.
|
28955
|
+
FORC: "0.53.0",
|
28956
28956
|
FUEL_CORE: "0.22.1",
|
28957
28957
|
FUELS: "0.79.0"
|
28958
28958
|
};
|
@@ -31144,7 +31144,7 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
31144
31144
|
toEvmAddress() {
|
31145
31145
|
const b256Address = toB256(this.bech32Address);
|
31146
31146
|
return {
|
31147
|
-
|
31147
|
+
bits: clearFirst12BytesFromB256(b256Address)
|
31148
31148
|
};
|
31149
31149
|
}
|
31150
31150
|
/**
|
@@ -31154,7 +31154,7 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
31154
31154
|
*/
|
31155
31155
|
toAssetId() {
|
31156
31156
|
return {
|
31157
|
-
|
31157
|
+
bits: this.toB256()
|
31158
31158
|
};
|
31159
31159
|
}
|
31160
31160
|
/**
|
@@ -31272,6 +31272,10 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
31272
31272
|
}
|
31273
31273
|
};
|
31274
31274
|
|
31275
|
+
// ../address/dist/configs.mjs
|
31276
|
+
var ZeroBytes32 = "0x0000000000000000000000000000000000000000000000000000000000000000";
|
31277
|
+
var BaseAssetId = ZeroBytes32;
|
31278
|
+
|
31275
31279
|
// ../math/dist/index.mjs
|
31276
31280
|
var import_bn = __toESM(require_bn(), 1);
|
31277
31281
|
var DEFAULT_PRECISION = 9;
|
@@ -31502,11 +31506,11 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
31502
31506
|
let max2;
|
31503
31507
|
if (Array.isArray(coinQuantityLike)) {
|
31504
31508
|
amount = coinQuantityLike[0];
|
31505
|
-
assetId = coinQuantityLike[1];
|
31506
|
-
max2 = coinQuantityLike[2];
|
31509
|
+
assetId = coinQuantityLike[1] ?? BaseAssetId;
|
31510
|
+
max2 = coinQuantityLike[2] ?? void 0;
|
31507
31511
|
} else {
|
31508
31512
|
amount = coinQuantityLike.amount;
|
31509
|
-
assetId = coinQuantityLike.assetId;
|
31513
|
+
assetId = coinQuantityLike.assetId ?? BaseAssetId;
|
31510
31514
|
max2 = coinQuantityLike.max ?? void 0;
|
31511
31515
|
}
|
31512
31516
|
const bnAmount = bn(amount);
|
@@ -38861,9 +38865,6 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
38861
38865
|
}
|
38862
38866
|
};
|
38863
38867
|
|
38864
|
-
// ../address/dist/configs.mjs
|
38865
|
-
var ZeroBytes32 = "0x0000000000000000000000000000000000000000000000000000000000000000";
|
38866
|
-
|
38867
38868
|
// src/providers/transaction-request/input.ts
|
38868
38869
|
var inputify = (value) => {
|
38869
38870
|
const { type: type3 } = value;
|
@@ -39540,8 +39541,6 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
39540
39541
|
outputs = [];
|
39541
39542
|
/** List of witnesses */
|
39542
39543
|
witnesses = [];
|
39543
|
-
/** Base asset ID - should be fetched from the chain */
|
39544
|
-
baseAssetId;
|
39545
39544
|
/**
|
39546
39545
|
* Constructor for initializing a base transaction request.
|
39547
39546
|
*
|
@@ -39554,9 +39553,8 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
39554
39553
|
witnessLimit,
|
39555
39554
|
inputs,
|
39556
39555
|
outputs,
|
39557
|
-
witnesses
|
39558
|
-
|
39559
|
-
}) {
|
39556
|
+
witnesses
|
39557
|
+
} = {}) {
|
39560
39558
|
this.gasPrice = bn(gasPrice);
|
39561
39559
|
this.maturity = maturity ?? 0;
|
39562
39560
|
this.witnessLimit = witnessLimit ? bn(witnessLimit) : void 0;
|
@@ -39564,7 +39562,6 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
39564
39562
|
this.inputs = inputs ?? [];
|
39565
39563
|
this.outputs = outputs ?? [];
|
39566
39564
|
this.witnesses = witnesses ?? [];
|
39567
|
-
this.baseAssetId = baseAssetId;
|
39568
39565
|
}
|
39569
39566
|
static getPolicyMeta(req) {
|
39570
39567
|
let policyTypes = 0;
|
@@ -39788,9 +39785,11 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
39788
39785
|
*
|
39789
39786
|
* @param message - Message resource.
|
39790
39787
|
* @param predicate - Predicate bytes.
|
39788
|
+
* @param predicateData - Predicate data bytes.
|
39791
39789
|
*/
|
39792
39790
|
addMessageInput(message, predicate) {
|
39793
39791
|
const { recipient, sender, amount } = message;
|
39792
|
+
const assetId = BaseAssetId;
|
39794
39793
|
let witnessIndex;
|
39795
39794
|
if (predicate) {
|
39796
39795
|
witnessIndex = 0;
|
@@ -39810,7 +39809,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
39810
39809
|
predicate: predicate?.bytes
|
39811
39810
|
};
|
39812
39811
|
this.pushInput(input);
|
39813
|
-
this.addChangeOutput(recipient,
|
39812
|
+
this.addChangeOutput(recipient, assetId);
|
39814
39813
|
}
|
39815
39814
|
/**
|
39816
39815
|
* Adds a single resource to the transaction by adding a coin/message input and a
|
@@ -39871,12 +39870,12 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
39871
39870
|
* @param amount - Amount of coin.
|
39872
39871
|
* @param assetId - Asset ID of coin.
|
39873
39872
|
*/
|
39874
|
-
addCoinOutput(to, amount, assetId) {
|
39873
|
+
addCoinOutput(to, amount, assetId = BaseAssetId) {
|
39875
39874
|
this.pushOutput({
|
39876
39875
|
type: OutputType.Coin,
|
39877
39876
|
to: addressify(to).toB256(),
|
39878
39877
|
amount,
|
39879
|
-
assetId
|
39878
|
+
assetId
|
39880
39879
|
});
|
39881
39880
|
return this;
|
39882
39881
|
}
|
@@ -39903,7 +39902,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
39903
39902
|
* @param to - Address of the owner.
|
39904
39903
|
* @param assetId - Asset ID of coin.
|
39905
39904
|
*/
|
39906
|
-
addChangeOutput(to, assetId) {
|
39905
|
+
addChangeOutput(to, assetId = BaseAssetId) {
|
39907
39906
|
const changeOutput = this.getChangeOutputs().find(
|
39908
39907
|
(output3) => hexlify(output3.assetId) === assetId
|
39909
39908
|
);
|
@@ -39911,7 +39910,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
39911
39910
|
this.pushOutput({
|
39912
39911
|
type: OutputType.Change,
|
39913
39912
|
to: addressify(to).toB256(),
|
39914
|
-
assetId
|
39913
|
+
assetId
|
39915
39914
|
});
|
39916
39915
|
}
|
39917
39916
|
}
|
@@ -39987,7 +39986,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
39987
39986
|
]);
|
39988
39987
|
}
|
39989
39988
|
};
|
39990
|
-
updateAssetInput(
|
39989
|
+
updateAssetInput(BaseAssetId, bn(1e11));
|
39991
39990
|
quantities.forEach((q) => updateAssetInput(q.assetId, q.amount));
|
39992
39991
|
}
|
39993
39992
|
/**
|
@@ -40144,7 +40143,12 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
40144
40143
|
*
|
40145
40144
|
* @param createTransactionRequestLike - The initial values for the instance
|
40146
40145
|
*/
|
40147
|
-
constructor({
|
40146
|
+
constructor({
|
40147
|
+
bytecodeWitnessIndex,
|
40148
|
+
salt,
|
40149
|
+
storageSlots,
|
40150
|
+
...rest
|
40151
|
+
} = {}) {
|
40148
40152
|
super(rest);
|
40149
40153
|
this.bytecodeWitnessIndex = bytecodeWitnessIndex ?? 0;
|
40150
40154
|
this.salt = hexlify(salt ?? ZeroBytes32);
|
@@ -40259,7 +40263,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
40259
40263
|
*
|
40260
40264
|
* @param scriptTransactionRequestLike - The initial values for the instance.
|
40261
40265
|
*/
|
40262
|
-
constructor({ script, scriptData, gasLimit, ...rest }) {
|
40266
|
+
constructor({ script, scriptData, gasLimit, ...rest } = {}) {
|
40263
40267
|
super(rest);
|
40264
40268
|
this.gasLimit = bn(gasLimit);
|
40265
40269
|
this.script = arrayify(script ?? returnZeroScript.bytes);
|
@@ -41405,7 +41409,6 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
41405
41409
|
gasPerByte: bn(feeParams.gasPerByte),
|
41406
41410
|
maxMessageDataLength: bn(predicateParams.maxMessageDataLength),
|
41407
41411
|
chainId: bn(consensusParameters.chainId),
|
41408
|
-
baseAssetId: consensusParameters.baseAssetId,
|
41409
41412
|
gasCosts
|
41410
41413
|
},
|
41411
41414
|
gasCosts,
|
@@ -41648,17 +41651,6 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
41648
41651
|
} = this.getChain();
|
41649
41652
|
return chainId.toNumber();
|
41650
41653
|
}
|
41651
|
-
/**
|
41652
|
-
* Returns the base asset ID
|
41653
|
-
*
|
41654
|
-
* @returns A promise that resolves to the base asset ID
|
41655
|
-
*/
|
41656
|
-
getBaseAssetId() {
|
41657
|
-
const {
|
41658
|
-
consensusParameters: { baseAssetId }
|
41659
|
-
} = this.getChain();
|
41660
|
-
return baseAssetId;
|
41661
|
-
}
|
41662
41654
|
/**
|
41663
41655
|
* Submits a transaction to the chain to be executed.
|
41664
41656
|
*
|
@@ -42715,9 +42707,8 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
42715
42707
|
* @param assetId - The asset ID to check the balance for.
|
42716
42708
|
* @returns A promise that resolves to the balance amount.
|
42717
42709
|
*/
|
42718
|
-
async getBalance(assetId) {
|
42719
|
-
const
|
42720
|
-
const amount = await this.provider.getBalance(this.address, assetIdToFetch);
|
42710
|
+
async getBalance(assetId = BaseAssetId) {
|
42711
|
+
const amount = await this.provider.getBalance(this.address, assetId);
|
42721
42712
|
return amount;
|
42722
42713
|
}
|
42723
42714
|
/**
|
@@ -42755,10 +42746,9 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
42755
42746
|
* @returns A promise that resolves when the resources are added to the transaction.
|
42756
42747
|
*/
|
42757
42748
|
async fund(request, coinQuantities, fee) {
|
42758
|
-
const baseAssetId = this.provider.getBaseAssetId();
|
42759
42749
|
const updatedQuantities = addAmountToAsset({
|
42760
42750
|
amount: bn(fee),
|
42761
|
-
assetId:
|
42751
|
+
assetId: BaseAssetId,
|
42762
42752
|
coinQuantities
|
42763
42753
|
});
|
42764
42754
|
const quantitiesDict = {};
|
@@ -42782,8 +42772,8 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
42782
42772
|
quantitiesDict[assetId].owned = quantitiesDict[assetId].owned.add(amount);
|
42783
42773
|
cachedUtxos.push(input.id);
|
42784
42774
|
}
|
42785
|
-
} else if (input.recipient === owner && input.amount && quantitiesDict[
|
42786
|
-
quantitiesDict[
|
42775
|
+
} else if (input.recipient === owner && input.amount && quantitiesDict[BaseAssetId]) {
|
42776
|
+
quantitiesDict[BaseAssetId].owned = quantitiesDict[BaseAssetId].owned.add(input.amount);
|
42787
42777
|
cachedMessages.push(input.nonce);
|
42788
42778
|
}
|
42789
42779
|
}
|
@@ -42815,13 +42805,11 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
42815
42805
|
* @param txParams - The transaction parameters (gasLimit, gasPrice, maturity).
|
42816
42806
|
* @returns A promise that resolves to the prepared transaction request.
|
42817
42807
|
*/
|
42818
|
-
async createTransfer(destination, amount, assetId, txParams = {}) {
|
42808
|
+
async createTransfer(destination, amount, assetId = BaseAssetId, txParams = {}) {
|
42819
42809
|
const { minGasPrice } = this.provider.getGasConfig();
|
42820
|
-
const
|
42821
|
-
const assetIdToTransfer = assetId ?? this.provider.getBaseAssetId();
|
42822
|
-
const params = { gasPrice: minGasPrice, baseAssetId, ...txParams };
|
42810
|
+
const params = { gasPrice: minGasPrice, ...txParams };
|
42823
42811
|
const request = new ScriptTransactionRequest(params);
|
42824
|
-
request.addCoinOutput(Address.fromAddressOrString(destination), amount,
|
42812
|
+
request.addCoinOutput(Address.fromAddressOrString(destination), amount, assetId);
|
42825
42813
|
const { maxFee, requiredQuantities, gasUsed, estimatedInputs } = await this.provider.getTransactionCost(request, [], {
|
42826
42814
|
estimateTxDependencies: true,
|
42827
42815
|
resourcesOwner: this
|
@@ -42847,15 +42835,14 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
42847
42835
|
* @param txParams - The transaction parameters (gasLimit, gasPrice, maturity).
|
42848
42836
|
* @returns A promise that resolves to the transaction response.
|
42849
42837
|
*/
|
42850
|
-
async transfer(destination, amount, assetId, txParams = {}) {
|
42838
|
+
async transfer(destination, amount, assetId = BaseAssetId, txParams = {}) {
|
42851
42839
|
if (bn(amount).lte(0)) {
|
42852
42840
|
throw new FuelError(
|
42853
42841
|
ErrorCode.INVALID_TRANSFER_AMOUNT,
|
42854
42842
|
"Transfer amount must be a positive number."
|
42855
42843
|
);
|
42856
42844
|
}
|
42857
|
-
const
|
42858
|
-
const request = await this.createTransfer(destination, amount, assetIdToTransfer, txParams);
|
42845
|
+
const request = await this.createTransfer(destination, amount, assetId, txParams);
|
42859
42846
|
return this.sendTransaction(request, { estimateTxDependencies: false });
|
42860
42847
|
}
|
42861
42848
|
/**
|
@@ -42867,7 +42854,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
42867
42854
|
* @param txParams - The optional transaction parameters.
|
42868
42855
|
* @returns A promise that resolves to the transaction response.
|
42869
42856
|
*/
|
42870
|
-
async transferToContract(contractId, amount, assetId, txParams = {}) {
|
42857
|
+
async transferToContract(contractId, amount, assetId = BaseAssetId, txParams = {}) {
|
42871
42858
|
if (bn(amount).lte(0)) {
|
42872
42859
|
throw new FuelError(
|
42873
42860
|
ErrorCode.INVALID_TRANSFER_AMOUNT,
|
@@ -42876,13 +42863,11 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
42876
42863
|
}
|
42877
42864
|
const contractAddress = Address.fromAddressOrString(contractId);
|
42878
42865
|
const { minGasPrice } = this.provider.getGasConfig();
|
42879
|
-
const
|
42880
|
-
const assetIdToTransfer = assetId ?? this.provider.getBaseAssetId();
|
42881
|
-
const params = { gasPrice: minGasPrice, baseAssetId, ...txParams };
|
42866
|
+
const params = { gasPrice: minGasPrice, ...txParams };
|
42882
42867
|
const { script, scriptData } = await assembleTransferToContractScript({
|
42883
42868
|
hexlifiedContractId: contractAddress.toB256(),
|
42884
42869
|
amountToTransfer: bn(amount),
|
42885
|
-
assetId
|
42870
|
+
assetId
|
42886
42871
|
});
|
42887
42872
|
const request = new ScriptTransactionRequest({
|
42888
42873
|
...params,
|
@@ -42892,7 +42877,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
42892
42877
|
request.addContractInputAndOutput(contractAddress);
|
42893
42878
|
const { maxFee, requiredQuantities, gasUsed } = await this.provider.getTransactionCost(
|
42894
42879
|
request,
|
42895
|
-
[{ amount: bn(amount), assetId: String(
|
42880
|
+
[{ amount: bn(amount), assetId: String(assetId) }]
|
42896
42881
|
);
|
42897
42882
|
request.gasLimit = bn(params.gasLimit ?? gasUsed);
|
42898
42883
|
this.validateGas({
|
@@ -42914,7 +42899,6 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
42914
42899
|
*/
|
42915
42900
|
async withdrawToBaseLayer(recipient, amount, txParams = {}) {
|
42916
42901
|
const { minGasPrice } = this.provider.getGasConfig();
|
42917
|
-
const baseAssetId = this.provider.getBaseAssetId();
|
42918
42902
|
const recipientAddress = Address.fromAddressOrString(recipient);
|
42919
42903
|
const recipientDataArray = arrayify(
|
42920
42904
|
"0x".concat(recipientAddress.toHexString().substring(2).padStart(64, "0"))
|
@@ -42927,14 +42911,9 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
42927
42911
|
...recipientDataArray,
|
42928
42912
|
...amountDataArray
|
42929
42913
|
]);
|
42930
|
-
const params = {
|
42931
|
-
script,
|
42932
|
-
gasPrice: minGasPrice,
|
42933
|
-
baseAssetId,
|
42934
|
-
...txParams
|
42935
|
-
};
|
42914
|
+
const params = { script, gasPrice: minGasPrice, ...txParams };
|
42936
42915
|
const request = new ScriptTransactionRequest(params);
|
42937
|
-
const forwardingQuantities = [{ amount: bn(amount), assetId:
|
42916
|
+
const forwardingQuantities = [{ amount: bn(amount), assetId: BaseAssetId }];
|
42938
42917
|
const { requiredQuantities, maxFee, gasUsed } = await this.provider.getTransactionCost(
|
42939
42918
|
request,
|
42940
42919
|
forwardingQuantities
|
@@ -47897,9 +47876,8 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
47897
47876
|
* @param txParams - The transaction parameters (gasLimit, gasPrice, maturity).
|
47898
47877
|
* @returns A promise that resolves to the prepared transaction request.
|
47899
47878
|
*/
|
47900
|
-
async createTransfer(destination, amount, assetId, txParams = {}) {
|
47901
|
-
const
|
47902
|
-
const request = await super.createTransfer(destination, amount, assetIdToTransfer, txParams);
|
47879
|
+
async createTransfer(destination, amount, assetId = BaseAssetId, txParams = {}) {
|
47880
|
+
const request = await super.createTransfer(destination, amount, assetId, txParams);
|
47903
47881
|
return this.populateTransactionPredicateData(request);
|
47904
47882
|
}
|
47905
47883
|
/**
|