@keetanetwork/keetanet-client 0.16.0 → 0.16.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/client/builder.d.ts +3 -3
- package/client/client_common_tests.d.ts +23 -4
- package/client/index-browser.d.ts +12 -11
- package/client/index-browser.js +585 -256
- package/client/index.d.ts +12 -11
- package/client/index.js +508 -213
- package/docs/assets/hierarchy.js +1 -1
- package/docs/assets/search.js +1 -1
- package/docs/classes/KeetaNetSDK.Client.html +10 -10
- package/docs/classes/KeetaNetSDK.Referenced.Account.html +30 -30
- package/docs/classes/KeetaNetSDK.Referenced.BaseSet.html +1 -1
- package/docs/classes/KeetaNetSDK.Referenced.BaseVoteBuilder.html +2 -2
- package/docs/classes/KeetaNetSDK.Referenced.Block.html +3 -3
- package/docs/classes/KeetaNetSDK.Referenced.BlockBuilder.html +1 -1
- package/docs/classes/KeetaNetSDK.Referenced.BlockHash.html +1 -1
- package/docs/classes/KeetaNetSDK.Referenced.BlockOperation.html +1 -1
- package/docs/classes/KeetaNetSDK.Referenced.BlockOperationCREATE_IDENTIFIER.html +2 -2
- package/docs/classes/KeetaNetSDK.Referenced.BlockOperationMANAGE_CERTIFICATE.html +2 -2
- package/docs/classes/KeetaNetSDK.Referenced.BlockOperationMODIFY_PERMISSIONS.html +2 -2
- package/docs/classes/KeetaNetSDK.Referenced.BlockOperationRECEIVE.html +2 -2
- package/docs/classes/KeetaNetSDK.Referenced.BlockOperationSEND.html +2 -2
- package/docs/classes/KeetaNetSDK.Referenced.BlockOperationSET_INFO.html +2 -2
- package/docs/classes/KeetaNetSDK.Referenced.BlockOperationSET_REP.html +2 -2
- package/docs/classes/KeetaNetSDK.Referenced.BlockOperationTOKEN_ADMIN_MODIFY_BALANCE.html +2 -2
- package/docs/classes/KeetaNetSDK.Referenced.BlockOperationTOKEN_ADMIN_SUPPLY.html +2 -2
- package/docs/classes/KeetaNetSDK.Referenced.Certificate.html +7 -7
- package/docs/classes/KeetaNetSDK.Referenced.CertificateBundle.html +1 -1
- package/docs/classes/KeetaNetSDK.Referenced.CertificateHash.html +1 -1
- package/docs/classes/KeetaNetSDK.Referenced.ECDSAKeyPair.html +1 -1
- package/docs/classes/KeetaNetSDK.Referenced.ECDSASECP256K1KeyPair.html +1 -1
- package/docs/classes/KeetaNetSDK.Referenced.ECDSASECP256K1PrivateKey.html +1 -1
- package/docs/classes/KeetaNetSDK.Referenced.ECDSASECP256K1PublicKey.html +1 -1
- package/docs/classes/KeetaNetSDK.Referenced.ECDSASECP256K1Signature.html +1 -1
- package/docs/classes/KeetaNetSDK.Referenced.ECDSASECP256R1KeyPair.html +1 -1
- package/docs/classes/KeetaNetSDK.Referenced.ECDSASECP256R1PrivateKey.html +1 -1
- package/docs/classes/KeetaNetSDK.Referenced.ECDSASECP256R1PublicKey.html +1 -1
- package/docs/classes/KeetaNetSDK.Referenced.ECDSASECP256R1Signature.html +1 -1
- package/docs/classes/KeetaNetSDK.Referenced.ED25519KeyPair.html +1 -1
- package/docs/classes/KeetaNetSDK.Referenced.ED25519PrivateKey.html +1 -1
- package/docs/classes/KeetaNetSDK.Referenced.ED25519PublicKey.html +1 -1
- package/docs/classes/KeetaNetSDK.Referenced.ED25519Signature.html +1 -1
- package/docs/classes/KeetaNetSDK.Referenced.ExternalKeyPair.html +1 -1
- package/docs/classes/KeetaNetSDK.Referenced.ExternalSet.html +1 -1
- package/docs/classes/KeetaNetSDK.Referenced.IdempotentKey.html +1 -1
- package/docs/classes/KeetaNetSDK.Referenced.IdentifierKey.html +1 -1
- package/docs/classes/KeetaNetSDK.Referenced.IdentifierKeyPair.html +4 -4
- package/docs/classes/KeetaNetSDK.Referenced.KeetaNetError.html +2 -2
- package/docs/classes/KeetaNetSDK.Referenced.KeetaNetErrorBase.html +1 -1
- package/docs/classes/KeetaNetSDK.Referenced.KeetaNetLedgerError.html +1 -1
- package/docs/classes/KeetaNetSDK.Referenced.KeetaNetLedgerIdempotentKeyError.html +1 -1
- package/docs/classes/KeetaNetSDK.Referenced.KeetaNetLedgerVoteError.html +1 -1
- package/docs/classes/KeetaNetSDK.Referenced.KeyInterface.html +1 -1
- package/docs/classes/KeetaNetSDK.Referenced.KeyStorage.html +1 -1
- package/docs/classes/KeetaNetSDK.Referenced.Ledger.html +2 -2
- package/docs/classes/KeetaNetSDK.Referenced.LedgerAtomicInterface.html +1 -1
- package/docs/classes/KeetaNetSDK.Referenced.P2PSwitch.html +2 -2
- package/docs/classes/KeetaNetSDK.Referenced.PermissionSetHolder.html +1 -1
- package/docs/classes/KeetaNetSDK.Referenced.PossiblyExpiredVote.html +2 -2
- package/docs/classes/KeetaNetSDK.Referenced.PossiblyUnsignedBlock.html +3 -3
- package/docs/classes/KeetaNetSDK.Referenced.SignatureStorage.html +1 -1
- package/docs/classes/KeetaNetSDK.Referenced.Stats.html +1 -1
- package/docs/classes/KeetaNetSDK.Referenced.StatsPending.html +1 -1
- package/docs/classes/KeetaNetSDK.Referenced.UnsignedBlock.html +3 -3
- package/docs/classes/KeetaNetSDK.Referenced.UserClientBuilder.html +11 -11
- package/docs/classes/KeetaNetSDK.Referenced.Vote.html +2 -2
- package/docs/classes/KeetaNetSDK.Referenced.VoteBlockBundle.html +4 -4
- package/docs/classes/KeetaNetSDK.Referenced.VoteBlockHash.html +1 -1
- package/docs/classes/KeetaNetSDK.Referenced.VoteBuilder.html +2 -2
- package/docs/classes/KeetaNetSDK.Referenced.VoteHash.html +1 -1
- package/docs/classes/KeetaNetSDK.Referenced.VoteLikeBase.html +2 -2
- package/docs/classes/KeetaNetSDK.Referenced.VoteQuote.html +2 -2
- package/docs/classes/KeetaNetSDK.Referenced.VoteQuoteBuilder.html +2 -2
- package/docs/classes/KeetaNetSDK.Referenced.VoteStaple.html +4 -4
- package/docs/classes/KeetaNetSDK.Referenced.VoteStapleHash.html +1 -1
- package/docs/classes/KeetaNetSDK.Referenced.src_lib_utils_buffer.BufferStorage.html +1 -1
- package/docs/classes/KeetaNetSDK.UserClient.html +20 -20
- package/docs/documents/GETTING-STARTED.html +1 -1
- package/docs/enums/KeetaNetSDK.Referenced.AccountKeyAlgorithm.html +8 -8
- package/docs/hierarchy.html +1 -1
- package/docs/interfaces/KeetaNetSDK.Referenced.ACLEntry.html +1 -1
- package/docs/interfaces/KeetaNetSDK.Referenced.ACLUpdate.html +1 -1
- package/docs/interfaces/KeetaNetSDK.Referenced.ASN1ExplicitContextTag.html +1 -1
- package/docs/interfaces/KeetaNetSDK.Referenced.ASN1ImplicitContextTag.html +1 -1
- package/docs/interfaces/KeetaNetSDK.Referenced.ASN1Object.html +1 -1
- package/docs/interfaces/KeetaNetSDK.Referenced.BaseAccountInfo.html +10 -0
- package/docs/interfaces/KeetaNetSDK.Referenced.BaseExternalKeyPairFunctions.html +1 -1
- package/docs/interfaces/KeetaNetSDK.Referenced.BaseGenerationConfig.html +2 -2
- package/docs/interfaces/KeetaNetSDK.Referenced.BaseIdentifierAccountInfo.html +12 -0
- package/docs/interfaces/KeetaNetSDK.Referenced.BaseIdentifierCreateArguments.html +1 -1
- package/docs/interfaces/KeetaNetSDK.Referenced.BlockJSONOperation.html +1 -1
- package/docs/interfaces/KeetaNetSDK.Referenced.BlockJSONOperationCREATE_IDENTIFIER.html +2 -2
- package/docs/interfaces/KeetaNetSDK.Referenced.BlockJSONOperationMANAGE_CERTIFICATE.html +2 -2
- package/docs/interfaces/KeetaNetSDK.Referenced.BlockJSONOperationMODIFY_PERMISSIONS.html +1 -1
- package/docs/interfaces/KeetaNetSDK.Referenced.BlockJSONOperationRECEIVE.html +1 -1
- package/docs/interfaces/KeetaNetSDK.Referenced.BlockJSONOperationSEND.html +1 -1
- package/docs/interfaces/KeetaNetSDK.Referenced.BlockJSONOperationSET_INFO.html +1 -1
- package/docs/interfaces/KeetaNetSDK.Referenced.BlockJSONOperationSET_REP.html +1 -1
- package/docs/interfaces/KeetaNetSDK.Referenced.BlockJSONOperationTOKEN_ADMIN_MODIFY_BALANCE.html +1 -1
- package/docs/interfaces/KeetaNetSDK.Referenced.BlockJSONOperationTOKEN_ADMIN_SUPPLY.html +1 -1
- package/docs/interfaces/KeetaNetSDK.Referenced.BlockV1Canonical.html +1 -1
- package/docs/interfaces/KeetaNetSDK.Referenced.BlockV1JSON.html +2 -2
- package/docs/interfaces/KeetaNetSDK.Referenced.BlockV2Canonical.html +1 -1
- package/docs/interfaces/KeetaNetSDK.Referenced.BuilderBlockOptions.html +2 -2
- package/docs/interfaces/KeetaNetSDK.Referenced.Constructor.html +1 -1
- package/docs/interfaces/KeetaNetSDK.Referenced.DisposableTimingHandle.html +1 -1
- package/docs/interfaces/KeetaNetSDK.Referenced.ECDSA_SECP256K1AccountInfo.html +10 -0
- package/docs/interfaces/KeetaNetSDK.Referenced.ECDSA_SECP256R1AccountInfo.html +10 -0
- package/docs/interfaces/KeetaNetSDK.Referenced.ED25519AccountInfo.html +10 -0
- package/docs/interfaces/KeetaNetSDK.Referenced.ExternalKeyPairFunctionsNoEncryption.html +1 -1
- package/docs/interfaces/KeetaNetSDK.Referenced.ExternalKeyPairFunctionsSupportsEncryption.html +1 -1
- package/docs/interfaces/KeetaNetSDK.Referenced.FeeAmountAndToken.html +2 -2
- package/docs/interfaces/KeetaNetSDK.Referenced.FeeAmountAndTokenJSON.html +2 -2
- package/docs/interfaces/KeetaNetSDK.Referenced.IdentifierCreateRequest.html +2 -2
- package/docs/interfaces/KeetaNetSDK.Referenced.InitialConfigSupply.html +2 -2
- package/docs/interfaces/KeetaNetSDK.Referenced.InstanceSet.html +1 -1
- package/docs/interfaces/KeetaNetSDK.Referenced.KVGenericOptionsType.html +1 -1
- package/docs/interfaces/KeetaNetSDK.Referenced.KVSetOptionsType.html +1 -1
- package/docs/interfaces/KeetaNetSDK.Referenced.LedgerConfig.html +4 -4
- package/docs/interfaces/KeetaNetSDK.Referenced.LedgerStorageAPI.html +5 -5
- package/docs/interfaces/KeetaNetSDK.Referenced.ModifyTokenBalanceEntry.html +1 -1
- package/docs/interfaces/KeetaNetSDK.Referenced.MultiSigIdentifierCreateArguments.html +2 -2
- package/docs/interfaces/KeetaNetSDK.Referenced.MultisigAccountInfo.html +14 -0
- package/docs/interfaces/KeetaNetSDK.Referenced.MultisigConfig.html +2 -2
- package/docs/interfaces/KeetaNetSDK.Referenced.NetworkAccountInfo.html +12 -0
- package/docs/interfaces/KeetaNetSDK.Referenced.NodeConfig.html +4 -4
- package/docs/interfaces/KeetaNetSDK.Referenced.NumericValueEntry.html +1 -1
- package/docs/interfaces/KeetaNetSDK.Referenced.P2PPeerBase.html +1 -1
- package/docs/interfaces/KeetaNetSDK.Referenced.P2PPeerListener.html +1 -1
- package/docs/interfaces/KeetaNetSDK.Referenced.P2PPeerRepBase.html +1 -1
- package/docs/interfaces/KeetaNetSDK.Referenced.PendingOperations.html +2 -2
- package/docs/interfaces/KeetaNetSDK.Referenced.PendingOperationsJSON.html +2 -2
- package/docs/interfaces/KeetaNetSDK.Referenced.PrincipalACLWithInfoParsed.html +3 -10
- package/docs/interfaces/KeetaNetSDK.Referenced.PublicKeyStorage.html +1 -1
- package/docs/interfaces/KeetaNetSDK.Referenced.PublishOptions.html +1 -1
- package/docs/interfaces/KeetaNetSDK.Referenced.RequestTokenReceiveEntry.html +1 -1
- package/docs/interfaces/KeetaNetSDK.Referenced.StorageAccountInfo.html +12 -0
- package/docs/interfaces/KeetaNetSDK.Referenced.TokenAccountInfo.html +14 -0
- package/docs/interfaces/KeetaNetSDK.Referenced.TokenNumericEntry.html +1 -1
- package/docs/interfaces/KeetaNetSDK.Referenced.UserClientConfig.html +2 -2
- package/docs/interfaces/KeetaNetSDK.Referenced.UserClientOptions.html +1 -1
- package/docs/interfaces/KeetaNetSDK.Referenced.VoteJSON.html +2 -2
- package/docs/interfaces/KeetaNetSDK.Referenced.VoteStapleJSON.html +2 -2
- package/docs/interfaces/KeetaNetSDK.Referenced.WithIsInstance.html +1 -1
- package/docs/interfaces/KeetaNetSDK.Referenced.src_lib_utils_asn1.ASN1BitString.html +1 -1
- package/docs/interfaces/KeetaNetSDK.Referenced.src_lib_utils_asn1.ASN1Date.html +1 -1
- package/docs/interfaces/KeetaNetSDK.Referenced.src_lib_utils_asn1.ASN1OID.html +1 -1
- package/docs/interfaces/KeetaNetSDK.Referenced.src_lib_utils_asn1.ASN1Set.html +1 -1
- package/docs/interfaces/KeetaNetSDK.Referenced.src_lib_utils_asn1.ASN1String.html +1 -1
- package/docs/interfaces/KeetaNetSDK.Referenced.src_lib_utils_asn1.ASN1Struct.html +1 -1
- package/docs/modules/KeetaNetSDK.Referenced.html +1 -1
- package/docs/modules/KeetaNetSDK.Referenced.src_lib_utils_helper.html +1 -1
- package/docs/types/KeetaNetSDK.Referenced.AccountInfo.html +1 -0
- package/docs/types/KeetaNetSDK.Referenced.AccountInfoForType.html +1 -0
- package/docs/types/KeetaNetSDK.Referenced.AccountInfoResponse.html +2 -2
- package/docs/types/KeetaNetSDK.Referenced.AccountInfoWithoutAccount.html +1 -0
- package/docs/types/{KeetaNetSDK.Referenced.src_lib_utils_helper.DistributiveOmit.html → KeetaNetSDK.Referenced.DistributiveOmit.html} +1 -1
- package/docs/types/KeetaNetSDK.Referenced.GetAccountStateAPIResponseFormatted.html +5 -12
- package/docs/types/KeetaNetSDK.Referenced.KeyPairAccountInfo.html +1 -0
- package/docs/types/KeetaNetSDK.Referenced.KeyPairKeyAlgorithm.html +1 -0
- package/docs/types/KeetaNetSDK.Referenced.NetworkAddress.html +1 -1
- package/docs/types/KeetaNetSDK.Referenced.StorageAddress.html +1 -1
- package/docs/types/KeetaNetSDK.Referenced.TokenAddress.html +1 -1
- package/docs/types/KeetaNetSDK.Referenced.TokenOrPending.html +1 -1
- package/docs/types/KeetaNetSDK.Referenced.UserEditableAccountInfo.html +1 -1
- package/docs/types/KeetaNetSDK.Referenced.VoteBuilderOptions.html +2 -2
- package/docs/types/KeetaNetSDK.Referenced.src_lib_utils_conversion.ToJSONSerializable.html +1 -1
- package/docs/types/KeetaNetSDK.Referenced.src_lib_utils_initial.BaseNetworkInfo.html +1 -1
- package/docs/variables/KeetaNetSDK.Referenced.allFullErrorCodes.html +1 -1
- package/docs/variables/KeetaNetSDK.Referenced.identifierKeyTypes.html +1 -1
- package/lib/account.d.ts +2 -1
- package/lib/block/index.d.ts +126 -108
- package/lib/block/operations.d.ts +11 -0
- package/lib/error/index.d.ts +1 -1
- package/lib/error/vote.d.ts +2 -2
- package/lib/ledger/common.d.ts +3 -3
- package/lib/ledger/db_dynamodb.d.ts +4 -4
- package/lib/ledger/db_postgres.d.ts +2 -2
- package/lib/ledger/db_spanner.d.ts +3 -3
- package/lib/ledger/db_spanner_helper.d.ts +1 -1
- package/lib/ledger/db_sqlite.d.ts +2 -2
- package/lib/ledger/effects.d.ts +3 -1
- package/lib/ledger/index.d.ts +7 -7
- package/lib/ledger/types.d.ts +43 -9
- package/lib/log/target_gcp.js +3 -0
- package/lib/log/target_https.js +7 -0
- package/lib/utils/certificate.d.ts +13 -12
- package/lib/utils/conversion.d.ts +12 -3
- package/lib/utils/initial.d.ts +3 -2
- package/lib/utils/never.d.ts +4 -0
- package/lib/vote.d.ts +96 -89
- package/npm-shrinkwrap.json +5 -5
- package/package.json +2 -2
- package/version.d.ts +1 -1
- package/docs/interfaces/KeetaNetSDK.Referenced.AccountInfo.html +0 -14
package/client/index-browser.js
CHANGED
|
@@ -113123,6 +113123,10 @@ function client_assertNever(value) {
|
|
|
113123
113123
|
// eslint-disable-next-line @typescript-eslint/restrict-template-expressions
|
|
113124
113124
|
throw new Error(`Unexpected value: ${value}`);
|
|
113125
113125
|
}
|
|
113126
|
+
|
|
113127
|
+
/**
|
|
113128
|
+
* Asserts that the provided type is never.
|
|
113129
|
+
*/
|
|
113126
113130
|
;// ./src/lib/utils/asn1.ts
|
|
113127
113131
|
/* provided dependency */ var client_asn1_process = __webpack_require__(5606);
|
|
113128
113132
|
/* provided dependency */ var client_asn1_Buffer = __webpack_require__(8287)["Buffer"];
|
|
@@ -115271,6 +115275,9 @@ function client_convertSingleValue(value) {
|
|
|
115271
115275
|
return checkPrefix(out, prefix, opts);
|
|
115272
115276
|
}
|
|
115273
115277
|
function client_toJSONSerializable(data, opts) {
|
|
115278
|
+
if (data === undefined) {
|
|
115279
|
+
throw new Error('undefined is not JSON serializable');
|
|
115280
|
+
}
|
|
115274
115281
|
return JSON.parse(JSON.stringify(client_convertSingleValue(data, opts)));
|
|
115275
115282
|
}
|
|
115276
115283
|
function client_conversion_objectToBuffer(data) {
|
|
@@ -118054,7 +118061,11 @@ async function client_computeLedgerEffect(options, effects, storageProvider, net
|
|
|
118054
118061
|
if (getAccountInfoPromises[accountPubKey] === undefined) {
|
|
118055
118062
|
getAccountInfoPromises[accountPubKey] = storageProvider.getAccountInfo(transaction, account);
|
|
118056
118063
|
}
|
|
118057
|
-
|
|
118064
|
+
|
|
118065
|
+
// We know this is correct as we are accessing the object via the account's public key
|
|
118066
|
+
// eslint-disable-next-line @typescript-eslint/consistent-type-assertions
|
|
118067
|
+
const resolved = await getAccountInfoPromises[accountPubKey];
|
|
118068
|
+
return resolved;
|
|
118058
118069
|
};
|
|
118059
118070
|
const getPermissionPromises = {};
|
|
118060
118071
|
const getPermissions = async (account, entityList) => {
|
|
@@ -118552,7 +118563,8 @@ class client_LedgerStorageBase {
|
|
|
118552
118563
|
_formatAccountInfoFromRow(account) {
|
|
118553
118564
|
var _row$name, _row$description, _row$metadata;
|
|
118554
118565
|
let row = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
118555
|
-
const
|
|
118566
|
+
const shared = {
|
|
118567
|
+
account: account,
|
|
118556
118568
|
name: (_row$name = row.name) !== null && _row$name !== void 0 ? _row$name : '',
|
|
118557
118569
|
description: (_row$description = row.description) !== null && _row$description !== void 0 ? _row$description : '',
|
|
118558
118570
|
metadata: (_row$metadata = row.metadata) !== null && _row$metadata !== void 0 ? _row$metadata : ''
|
|
@@ -118567,16 +118579,46 @@ class client_LedgerStorageBase {
|
|
|
118567
118579
|
if (!Permissions.ExternalSet.isInstance(externalSet)) {
|
|
118568
118580
|
externalSet = BigInt(externalSet);
|
|
118569
118581
|
}
|
|
118570
|
-
|
|
118571
|
-
|
|
118572
|
-
|
|
118573
|
-
|
|
118574
|
-
|
|
118575
|
-
|
|
118576
|
-
|
|
118577
|
-
|
|
118582
|
+
const identifierShared = {
|
|
118583
|
+
...shared,
|
|
118584
|
+
defaultPermission: new Permissions(baseSet, externalSet)
|
|
118585
|
+
};
|
|
118586
|
+
if (account.isToken()) {
|
|
118587
|
+
var _row$supply;
|
|
118588
|
+
return {
|
|
118589
|
+
...identifierShared,
|
|
118590
|
+
account: account,
|
|
118591
|
+
supply: BigInt((_row$supply = row.supply) !== null && _row$supply !== void 0 ? _row$supply : 0)
|
|
118592
|
+
};
|
|
118593
|
+
} else if (account.isMultisig()) {
|
|
118594
|
+
return {
|
|
118595
|
+
...identifierShared,
|
|
118596
|
+
account: account,
|
|
118597
|
+
multisigQuorum: row.multisigQuorum ? BigInt(row.multisigQuorum) : null
|
|
118598
|
+
};
|
|
118599
|
+
} else if (account.isNetwork()) {
|
|
118600
|
+
return {
|
|
118601
|
+
...identifierShared,
|
|
118602
|
+
account
|
|
118603
|
+
};
|
|
118604
|
+
} else if (account.isStorage()) {
|
|
118605
|
+
return {
|
|
118606
|
+
...identifierShared,
|
|
118607
|
+
account
|
|
118608
|
+
};
|
|
118609
|
+
} else {
|
|
118610
|
+
throw new Error('Unsupported identifier account type for AccountInfo');
|
|
118611
|
+
}
|
|
118612
|
+
} else if (account.isAccount()) {
|
|
118613
|
+
// We know that this type is correct, the only way to avoid this assertion is to have an if statement for every single account type which would be unwieldy
|
|
118614
|
+
// eslint-disable-next-line @typescript-eslint/consistent-type-assertions
|
|
118615
|
+
return {
|
|
118616
|
+
...shared,
|
|
118617
|
+
account: account
|
|
118618
|
+
};
|
|
118619
|
+
} else {
|
|
118620
|
+
throw new Error('Unsupported account type for AccountInfo');
|
|
118578
118621
|
}
|
|
118579
|
-
return ret;
|
|
118580
118622
|
}
|
|
118581
118623
|
_validateAccountInfoKeys(account, info) {
|
|
118582
118624
|
const validKeys = ['name', 'description', 'metadata'];
|
|
@@ -118591,6 +118633,7 @@ class client_LedgerStorageBase {
|
|
|
118591
118633
|
}
|
|
118592
118634
|
const keys = Object.keys(info);
|
|
118593
118635
|
const foundBannedKey = keys.find(function (key) {
|
|
118636
|
+
// eslint-disable-next-line @typescript-eslint/consistent-type-assertions
|
|
118594
118637
|
return validKeys.includes(key) === false;
|
|
118595
118638
|
});
|
|
118596
118639
|
if (foundBannedKey !== undefined) {
|
|
@@ -118731,6 +118774,30 @@ function client_operationTypeToNumber(str) {
|
|
|
118731
118774
|
}
|
|
118732
118775
|
return type;
|
|
118733
118776
|
}
|
|
118777
|
+
function client_makeEncodeDecodePermission(emptyValue) {
|
|
118778
|
+
return {
|
|
118779
|
+
encode: data => {
|
|
118780
|
+
if (!data) {
|
|
118781
|
+
return emptyValue;
|
|
118782
|
+
}
|
|
118783
|
+
const encoded = client_permissions_Permissions.FromAcceptedTypes(data);
|
|
118784
|
+
return [encoded.base.bigint, encoded.external.bigint];
|
|
118785
|
+
},
|
|
118786
|
+
decode: data => {
|
|
118787
|
+
if (!data) {
|
|
118788
|
+
return emptyValue;
|
|
118789
|
+
}
|
|
118790
|
+
if (!Array.isArray(data) || data.length !== 2) {
|
|
118791
|
+
throw new Error('Invalid permissions data');
|
|
118792
|
+
}
|
|
118793
|
+
if (typeof data[0] !== 'bigint' || typeof data[1] !== 'bigint') {
|
|
118794
|
+
throw new Error('Invalid permissions data types');
|
|
118795
|
+
}
|
|
118796
|
+
return new client_permissions_Permissions(data[0], data[1]);
|
|
118797
|
+
}
|
|
118798
|
+
};
|
|
118799
|
+
}
|
|
118800
|
+
|
|
118734
118801
|
/**
|
|
118735
118802
|
* Schema for each operation as well as names of each field within the block operations
|
|
118736
118803
|
*/
|
|
@@ -118797,7 +118864,8 @@ const client_BlockOperationASN1SchemaBase = {
|
|
|
118797
118864
|
name: 'defaultPermission',
|
|
118798
118865
|
schema: {
|
|
118799
118866
|
optional: [client_ValidateASN1.IsInteger, client_ValidateASN1.IsInteger]
|
|
118800
|
-
}
|
|
118867
|
+
},
|
|
118868
|
+
...client_makeEncodeDecodePermission(undefined)
|
|
118801
118869
|
}],
|
|
118802
118870
|
'MODIFY_PERMISSIONS': [{
|
|
118803
118871
|
name: 'principal',
|
|
@@ -118809,7 +118877,8 @@ const client_BlockOperationASN1SchemaBase = {
|
|
|
118809
118877
|
name: 'permissions',
|
|
118810
118878
|
schema: {
|
|
118811
118879
|
choice: [client_ValidateASN1.IsNull, [client_ValidateASN1.IsInteger, client_ValidateASN1.IsInteger]]
|
|
118812
|
-
}
|
|
118880
|
+
},
|
|
118881
|
+
...client_makeEncodeDecodePermission(null)
|
|
118813
118882
|
}, {
|
|
118814
118883
|
name: 'target',
|
|
118815
118884
|
schema: {
|
|
@@ -118832,6 +118901,56 @@ const client_BlockOperationASN1SchemaBase = {
|
|
|
118832
118901
|
}, client_ValidateASN1.IsInteger]
|
|
118833
118902
|
}]
|
|
118834
118903
|
}
|
|
118904
|
+
},
|
|
118905
|
+
encode: data => {
|
|
118906
|
+
if (!data) {
|
|
118907
|
+
return null;
|
|
118908
|
+
}
|
|
118909
|
+
if (data.type === client_AccountKeyAlgorithm.MULTISIG) {
|
|
118910
|
+
return {
|
|
118911
|
+
type: 'context',
|
|
118912
|
+
kind: 'explicit',
|
|
118913
|
+
value: data.type,
|
|
118914
|
+
contains: [data.signers.map(function (signer) {
|
|
118915
|
+
return signer.publicKeyAndType;
|
|
118916
|
+
}), data.quorum]
|
|
118917
|
+
};
|
|
118918
|
+
} else {
|
|
118919
|
+
throw new Error(`Unrecognized createArguments type for CREATE_IDENTIFIER operation`);
|
|
118920
|
+
}
|
|
118921
|
+
},
|
|
118922
|
+
decode: data => {
|
|
118923
|
+
if (!data) {
|
|
118924
|
+
return undefined;
|
|
118925
|
+
}
|
|
118926
|
+
if (!client_ASN1CheckUtilities.isASN1ContextTag(data, 'explicit')) {
|
|
118927
|
+
throw new Error('Invalid createArgs type for CREATE_IDENTIFIER operation');
|
|
118928
|
+
}
|
|
118929
|
+
if (data.value === client_AccountKeyAlgorithm.MULTISIG) {
|
|
118930
|
+
if (!Array.isArray(data.contains) || data.contains.length !== 2) {
|
|
118931
|
+
throw new Error('Invalid createArgs container');
|
|
118932
|
+
}
|
|
118933
|
+
if (!Array.isArray(data.contains[0]) || typeof data.contains[1] !== 'bigint') {
|
|
118934
|
+
throw new Error('Invalid createArgs container');
|
|
118935
|
+
}
|
|
118936
|
+
return {
|
|
118937
|
+
type: data.value,
|
|
118938
|
+
signers: data.contains[0].map(function (value) {
|
|
118939
|
+
if (!client_operations_Buffer.isBuffer(value)) {
|
|
118940
|
+
throw new Error(`Invalid signer value, expected Buffer, got ${typeof value}`);
|
|
118941
|
+
}
|
|
118942
|
+
const account = client_lib_account.fromPublicKeyAndType(value);
|
|
118943
|
+
if (account.isAccount() || account.isMultisig()) {
|
|
118944
|
+
return account;
|
|
118945
|
+
} else {
|
|
118946
|
+
throw new Error('Signer for multisig must be an account or another multisig');
|
|
118947
|
+
}
|
|
118948
|
+
}),
|
|
118949
|
+
quorum: BigInt(data.contains[1])
|
|
118950
|
+
};
|
|
118951
|
+
} else {
|
|
118952
|
+
throw new Error('unrecognized type for multisig create arguments');
|
|
118953
|
+
}
|
|
118835
118954
|
}
|
|
118836
118955
|
}],
|
|
118837
118956
|
'TOKEN_ADMIN_SUPPLY': [{
|
|
@@ -118856,7 +118975,26 @@ const client_BlockOperationASN1SchemaBase = {
|
|
|
118856
118975
|
schema: client_ValidateASN1.IsInteger
|
|
118857
118976
|
}, {
|
|
118858
118977
|
name: 'certificateOrHash',
|
|
118859
|
-
schema: client_ValidateASN1.IsOctetString
|
|
118978
|
+
schema: client_ValidateASN1.IsOctetString,
|
|
118979
|
+
encode: data => {
|
|
118980
|
+
if (src_client_Certificate.isCertificate(data)) {
|
|
118981
|
+
return client_operations_Buffer.from(data.toDER());
|
|
118982
|
+
} else if (src_client_CertificateHash.isInstance(data)) {
|
|
118983
|
+
return data.getBuffer();
|
|
118984
|
+
} else {
|
|
118985
|
+
throw new Error('Invalid certificate or hash data type');
|
|
118986
|
+
}
|
|
118987
|
+
},
|
|
118988
|
+
decode: data => {
|
|
118989
|
+
if (!client_isBuffer(data)) {
|
|
118990
|
+
throw new Error('Invalid certificate or hash data type');
|
|
118991
|
+
}
|
|
118992
|
+
if (data.length === 32) {
|
|
118993
|
+
return new src_client_CertificateHash(data.toString('hex'));
|
|
118994
|
+
} else {
|
|
118995
|
+
return new src_client_Certificate(data);
|
|
118996
|
+
}
|
|
118997
|
+
}
|
|
118860
118998
|
}, {
|
|
118861
118999
|
name: 'intermediateCertificates',
|
|
118862
119000
|
schema: {
|
|
@@ -118865,6 +119003,28 @@ const client_BlockOperationASN1SchemaBase = {
|
|
|
118865
119003
|
sequenceOf: client_ValidateASN1.IsOctetString
|
|
118866
119004
|
}]
|
|
118867
119005
|
}
|
|
119006
|
+
},
|
|
119007
|
+
decode: data => {
|
|
119008
|
+
if (!data) {
|
|
119009
|
+
return null;
|
|
119010
|
+
}
|
|
119011
|
+
if (!Array.isArray(data)) {
|
|
119012
|
+
throw new Error('Invalid intermediate certificates data');
|
|
119013
|
+
}
|
|
119014
|
+
return new src_client_CertificateBundle(data.map(function (certificate) {
|
|
119015
|
+
if (!client_isBuffer(certificate)) {
|
|
119016
|
+
throw new Error('Invalid intermediate certificate data type');
|
|
119017
|
+
}
|
|
119018
|
+
return new src_client_Certificate(certificate);
|
|
119019
|
+
}));
|
|
119020
|
+
},
|
|
119021
|
+
encode: data => {
|
|
119022
|
+
if (!data) {
|
|
119023
|
+
return null;
|
|
119024
|
+
}
|
|
119025
|
+
return data.getCertificates().map(function (certificate) {
|
|
119026
|
+
return client_operations_Buffer.from(certificate.toDER());
|
|
119027
|
+
});
|
|
118868
119028
|
}
|
|
118869
119029
|
}]
|
|
118870
119030
|
};
|
|
@@ -119859,35 +120019,26 @@ function client_ExportBlockOperations(operations) {
|
|
|
119859
120019
|
for (const entry of operations) {
|
|
119860
120020
|
const operationContainer = [];
|
|
119861
120021
|
const typeStr = client_operationTypeToString(entry.type);
|
|
119862
|
-
const
|
|
119863
|
-
if (!typeStr || !
|
|
120022
|
+
const operationSchemas = client_BlockOperationASN1SchemaBase[typeStr];
|
|
120023
|
+
if (!typeStr || !operationSchemas) {
|
|
119864
120024
|
throw new Error(`Unable to serialize operation with type ${entry.type} ${client_toJSONSerializable(entry)}`);
|
|
119865
120025
|
}
|
|
119866
120026
|
|
|
119867
120027
|
// We want to be able to read any key on the operation, so we need to cast it to any
|
|
119868
120028
|
const unTypedEntry = entry;
|
|
119869
|
-
for (const {
|
|
119870
|
-
|
|
119871
|
-
|
|
119872
|
-
|
|
120029
|
+
for (const operationSchema of operationSchemas) {
|
|
120030
|
+
const {
|
|
120031
|
+
name: key,
|
|
120032
|
+
schema
|
|
120033
|
+
} = operationSchema;
|
|
119873
120034
|
let valueToWrite = unTypedEntry[key];
|
|
119874
120035
|
if (valueToWrite === undefined) {
|
|
119875
120036
|
if (typeof schema === 'object' && schema && !('optional' in schema)) {
|
|
119876
120037
|
throw new Error(`Key ${key} for operation ${typeStr} is not optional but undefined value provided`);
|
|
119877
120038
|
}
|
|
119878
120039
|
continue;
|
|
119879
|
-
} else if (
|
|
119880
|
-
|
|
119881
|
-
// eslint-disable-next-line @typescript-eslint/consistent-type-assertions
|
|
119882
|
-
const typedValue = valueToWrite;
|
|
119883
|
-
valueToWrite = {
|
|
119884
|
-
type: 'context',
|
|
119885
|
-
kind: 'explicit',
|
|
119886
|
-
value: valueToWrite.type,
|
|
119887
|
-
contains: [typedValue.signers.map(function (signer) {
|
|
119888
|
-
return signer.publicKeyAndType;
|
|
119889
|
-
}), typedValue.quorum]
|
|
119890
|
-
};
|
|
120040
|
+
} else if ('encode' in operationSchema) {
|
|
120041
|
+
valueToWrite = operationSchema.encode(valueToWrite);
|
|
119891
120042
|
} else if (typeof valueToWrite === 'string') {
|
|
119892
120043
|
valueToWrite = {
|
|
119893
120044
|
type: 'string',
|
|
@@ -119896,16 +120047,10 @@ function client_ExportBlockOperations(operations) {
|
|
|
119896
120047
|
};
|
|
119897
120048
|
} else if (client_lib_account.isInstance(valueToWrite)) {
|
|
119898
120049
|
valueToWrite = valueToWrite.publicKeyAndType;
|
|
119899
|
-
} else if (client_permissions_Permissions.isInstance(valueToWrite)) {
|
|
119900
|
-
valueToWrite = [valueToWrite.base.bigint, valueToWrite.external.bigint];
|
|
119901
120050
|
} else if (src_client_Certificate.isCertificate(valueToWrite)) {
|
|
119902
120051
|
valueToWrite = client_operations_Buffer.from(valueToWrite.toDER());
|
|
119903
120052
|
} else if (src_client_CertificateHash.isInstance(valueToWrite)) {
|
|
119904
120053
|
valueToWrite = valueToWrite.getBuffer();
|
|
119905
|
-
} else if (src_client_CertificateBundle.isInstance(valueToWrite)) {
|
|
119906
|
-
valueToWrite = valueToWrite.getCertificates().map(function (certificate) {
|
|
119907
|
-
return client_operations_Buffer.from(certificate.toDER());
|
|
119908
|
-
});
|
|
119909
120054
|
}
|
|
119910
120055
|
operationContainer.push(valueToWrite);
|
|
119911
120056
|
}
|
|
@@ -119933,72 +120078,29 @@ function client_ImportOperationsASN1(input, network) {
|
|
|
119933
120078
|
throw new Error(`Found entry which is not a Sequence ${typeof entry}`);
|
|
119934
120079
|
}
|
|
119935
120080
|
const typeStr = client_operationTypeToString(type);
|
|
119936
|
-
const
|
|
119937
|
-
if (!
|
|
120081
|
+
const operationSchemas = client_BlockOperationASN1SchemaBase[typeStr];
|
|
120082
|
+
if (!operationSchemas) {
|
|
119938
120083
|
throw new Error(`Found valid operation ${typeStr} with invalid keys`);
|
|
119939
120084
|
}
|
|
119940
120085
|
operation.type = type;
|
|
119941
120086
|
let keyIndex = -1;
|
|
119942
|
-
for (const {
|
|
119943
|
-
|
|
119944
|
-
} of operationSchema) {
|
|
120087
|
+
for (const operationSchema of operationSchemas) {
|
|
120088
|
+
const key = operationSchema.name;
|
|
119945
120089
|
keyIndex++;
|
|
119946
120090
|
const keyValueIn = entry[keyIndex];
|
|
119947
120091
|
let keyValueOut = undefined;
|
|
119948
120092
|
if (keyValueIn === undefined) {
|
|
119949
120093
|
break;
|
|
120094
|
+
} else if ('decode' in operationSchema) {
|
|
120095
|
+
keyValueOut = operationSchema.decode(keyValueIn);
|
|
119950
120096
|
} else if (['bigint', 'string', 'boolean'].includes(typeof keyValueIn)) {
|
|
119951
120097
|
keyValueOut = keyValueIn;
|
|
119952
120098
|
} else if (typeof keyValueIn === 'number') {
|
|
119953
120099
|
keyValueOut = client_ASN1IntegerToBigInt(keyValueIn);
|
|
119954
120100
|
} else if (keyValueIn === null) {
|
|
119955
120101
|
keyValueOut = null;
|
|
119956
|
-
} else if (Array.isArray(keyValueIn) && key.toLowerCase().includes('permission')) {
|
|
119957
|
-
// We are parsing a Permission
|
|
119958
|
-
const [base, external] = keyValueIn;
|
|
119959
|
-
const newKeyValue = new client_permissions_Permissions(base, external);
|
|
119960
|
-
newKeyValue.validate(network);
|
|
119961
|
-
keyValueOut = newKeyValue;
|
|
119962
|
-
} else if (key === 'createArguments' && typeStr === 'CREATE_IDENTIFIER') {
|
|
119963
|
-
if (!client_ASN1CheckUtilities.isASN1ContextTag(keyValueIn, 'explicit')) {
|
|
119964
|
-
throw new Error('Invalid createArgs type for CREATE_IDENTIFIER operation');
|
|
119965
|
-
}
|
|
119966
|
-
if (keyValueIn.value !== client_AccountKeyAlgorithm.MULTISIG) {
|
|
119967
|
-
throw new Error('unrecognized type for multisig create arguments');
|
|
119968
|
-
}
|
|
119969
|
-
if (!Array.isArray(keyValueIn.contains) || keyValueIn.contains.length !== 2) {
|
|
119970
|
-
throw new Error('Invalid createArgs container');
|
|
119971
|
-
}
|
|
119972
|
-
if (!Array.isArray(keyValueIn.contains[0])) {
|
|
119973
|
-
throw new Error('Invalid createArgs container');
|
|
119974
|
-
}
|
|
119975
|
-
keyValueOut = {
|
|
119976
|
-
type: keyValueIn.value,
|
|
119977
|
-
signers: keyValueIn.contains[0].map(function (value) {
|
|
119978
|
-
if (!client_operations_Buffer.isBuffer(value)) {
|
|
119979
|
-
throw new Error(`Invalid signer value, expected Buffer, got ${typeof value}`);
|
|
119980
|
-
}
|
|
119981
|
-
return client_lib_account.fromPublicKeyAndType(value);
|
|
119982
|
-
}),
|
|
119983
|
-
quorum: keyValueIn.contains[1]
|
|
119984
|
-
};
|
|
119985
|
-
} else if (Array.isArray(keyValueIn) && key === 'intermediateCertificates') {
|
|
119986
|
-
keyValueOut = new src_client_CertificateBundle(keyValueIn.map(function (certificate) {
|
|
119987
|
-
return new src_client_Certificate(certificate);
|
|
119988
|
-
}));
|
|
119989
120102
|
} else if (client_isBuffer(keyValueIn)) {
|
|
119990
|
-
|
|
119991
|
-
const method = client_toAdjustMethod(operation['method']);
|
|
119992
|
-
if (method === client_AdjustMethod.SUBTRACT) {
|
|
119993
|
-
keyValueOut = new src_client_CertificateHash(keyValueIn);
|
|
119994
|
-
} else if (method === client_AdjustMethod.ADD) {
|
|
119995
|
-
keyValueOut = new src_client_Certificate(keyValueIn);
|
|
119996
|
-
} else {
|
|
119997
|
-
throw new Error(`Unrecognized method for MANAGE_CERTIFICATE operation: ${method}`);
|
|
119998
|
-
}
|
|
119999
|
-
} else {
|
|
120000
|
-
keyValueOut = client_lib_account.fromPublicKeyAndType(keyValueIn);
|
|
120001
|
-
}
|
|
120103
|
+
keyValueOut = client_lib_account.fromPublicKeyAndType(keyValueIn);
|
|
120002
120104
|
} else if (typeof keyValueIn === 'object' && keyValueIn !== null) {
|
|
120003
120105
|
if ('type' in keyValueIn && 'kind' in keyValueIn && 'value' in keyValueIn) {
|
|
120004
120106
|
if (keyValueIn.type === 'string' && keyValueIn.kind === 'utf8') {
|
|
@@ -120943,7 +121045,7 @@ function client_validateRecalculatedBytes() {
|
|
|
120943
121045
|
if (!recalculatedBytesBuffer.equals(existingBytesBuffer)) {
|
|
120944
121046
|
const existingBytesHash = client_block_Buffer.from(client_hash_Hash(existingBytesBuffer)).toString('hex').toUpperCase();
|
|
120945
121047
|
const recalculatedBytesHash = client_block_Buffer.from(client_hash_Hash(recalculatedBytesBuffer)).toString('hex').toUpperCase();
|
|
120946
|
-
throw new src_client_KeetaNetBlockError('BLOCK_INVALID_SIGNATURE', `Block signed bytes (${existingBytesHash}) do not match calculated bytes (${recalculatedBytesHash})`);
|
|
121048
|
+
throw new src_client_KeetaNetBlockError('BLOCK_INVALID_SIGNATURE', `Block signed bytes (${existingBytesHash}) do not match calculated bytes (${recalculatedBytesHash}) for block with hash ${this.hash.toString()}`);
|
|
120947
121049
|
}
|
|
120948
121050
|
}
|
|
120949
121051
|
function client_validateOperationsPurpose() {
|
|
@@ -123662,7 +123764,7 @@ const client_VoteErrorCodes = [
|
|
|
123662
123764
|
// Errors related to VoteStaple
|
|
123663
123765
|
'STAPLE_INVALID_CONSTRUCTION', 'STAPLE_ALL_VOTES_MUST_HAVE_SAME_BLOCKS_COUNT', 'STAPLE_ALL_VOTES_MUST_HAVE_SAME_BLOCKS_MISSING', 'STAPLE_ALL_VOTES_MUST_HAVE_SAME_BLOCKS_ORDER', 'STAPLE_DUPLICATE_VOTE_ISSUER', 'STAPLE_PERMANENCE_MISMATCH',
|
|
123664
123766
|
// Errors related to VoteBuilder
|
|
123665
|
-
'BUILDER_INVALID_CONSTRUCTION', 'BUILDER_INVALID_BLOCK_TYPE', 'BUILDER_INVALID_SERIAL', 'BUILDER_INVALID_VALID_TO_FROM',
|
|
123767
|
+
'BUILDER_INVALID_CONSTRUCTION', 'BUILDER_INVALID_BLOCK_TYPE', 'BUILDER_INVALID_SERIAL', 'BUILDER_INVALID_VALID_TO_FROM', 'BUILDER_INVALID_FEE',
|
|
123666
123768
|
/**
|
|
123667
123769
|
* Malformed ASN.1 Errors
|
|
123668
123770
|
*/
|
|
@@ -123676,7 +123778,7 @@ const client_VoteErrorCodes = [
|
|
|
123676
123778
|
// Errors from the blockHashesFromVote function
|
|
123677
123779
|
'MALFORMED_HASHES_FROM_VOTE_INVALID_INPUT', 'MALFORMED_HASHES_FROM_VOTE_INVALID_TYPE', 'MALFORMED_HASHES_FROM_VOTE_INVALID_CONTEXT_SPECIFIC', 'MALFORMED_HASHES_FROM_VOTE_DATA_NEEDS_OID', 'MALFORMED_HASHES_FROM_VOTE_DATA_HASH_DATA_MUST_BE_SEQUENCE', 'MALFORMED_HASHES_FROM_VOTE_DATA_NOT_TWO_ITEMS', 'MALFORMED_HASHES_FROM_VOTE_DATA_UNSUPPORTED_HASH_FUNC', 'MALFORMED_HASHES_FROM_VOTE_DATA_UNSUPPORTED_HASH_TYPE', 'MALFORMED_HASHES_FROM_VOTE_DATA_SECOND_MUST_BE_SEQUENCE',
|
|
123678
123780
|
// Errors from the feesFromVote function
|
|
123679
|
-
'MALFORMED_FEES_AMOUNT', 'MALFORMED_FEES_FROM_VOTE_INVALID_INPUT', 'MALFORMED_FEES_IN_PERMANENT_VOTE', 'MALFORMED_FEES_PAY_TO_INVALID', 'MALFORMED_FEES_TOKEN_NOT_TOKEN',
|
|
123781
|
+
'MALFORMED_FEES_AMOUNT', 'MALFORMED_FEES_FROM_VOTE_INVALID_INPUT', 'MALFORMED_FEES_IN_PERMANENT_VOTE', 'MALFORMED_FEES_INVALID_QUOTE_VALUE', 'MALFORMED_FEES_MULTIPLE_FEE_EMPTY', 'MALFORMED_FEES_PAY_TO_INVALID', 'MALFORMED_FEES_TOKEN_NOT_TOKEN',
|
|
123680
123782
|
// Fee Quote Errors
|
|
123681
123783
|
'FEE_IS_QUOTE', 'FEE_QUOTE_MISSING_FEES', 'FEE_NOT_QUOTE', 'MALFORMED_FEES_KIND_MISSING', 'MALFORMED_FEES_QUOTE_INVALID'];
|
|
123682
123784
|
const client_FullVoteErrorCodes = client_VoteErrorCodes.map(code => `${client_VoteErrorType}_${code}`);
|
|
@@ -123836,7 +123938,7 @@ function client_addPermissionRequirement(state, requirement) {
|
|
|
123836
123938
|
}
|
|
123837
123939
|
if (state.accounts[entityPubKey] !== undefined) {
|
|
123838
123940
|
const entityInfo = state.accounts[entityPubKey].fields.info;
|
|
123839
|
-
if (entityInfo !== undefined) {
|
|
123941
|
+
if (entityInfo !== undefined && 'defaultPermission' in entityInfo) {
|
|
123840
123942
|
const defaultPermission = entityInfo.defaultPermission;
|
|
123841
123943
|
if (defaultPermission !== undefined) {
|
|
123842
123944
|
if (requirement.permissions === null || defaultPermission.has(requirement.permissions)) {
|
|
@@ -123915,17 +124017,25 @@ function client_modifyBalanceInState(balanceState) {
|
|
|
123915
124017
|
}
|
|
123916
124018
|
function client_updateAccountInfoInState(state, account, info) {
|
|
123917
124019
|
const accountPubKey = account.publicKeyString.get();
|
|
123918
|
-
|
|
124020
|
+
let toUpdate = {
|
|
123919
124021
|
name: info.name,
|
|
123920
124022
|
description: info.description,
|
|
123921
124023
|
metadata: info.metadata
|
|
123922
124024
|
};
|
|
123923
124025
|
if (account.isIdentifier()) {
|
|
123924
|
-
if (info.defaultPermission !== undefined) {
|
|
123925
|
-
toUpdate
|
|
124026
|
+
if ('defaultPermission' in info && info.defaultPermission !== undefined) {
|
|
124027
|
+
toUpdate = {
|
|
124028
|
+
...toUpdate,
|
|
124029
|
+
defaultPermission: info.defaultPermission
|
|
124030
|
+
};
|
|
123926
124031
|
}
|
|
123927
|
-
if (account.isMultisig()
|
|
123928
|
-
|
|
124032
|
+
if (account.isMultisig()) {
|
|
124033
|
+
if ('multisigQuorum' in info && info.multisigQuorum !== undefined) {
|
|
124034
|
+
toUpdate = {
|
|
124035
|
+
...toUpdate,
|
|
124036
|
+
multisigQuorum: info.multisigQuorum
|
|
124037
|
+
};
|
|
124038
|
+
}
|
|
123929
124039
|
}
|
|
123930
124040
|
} else {
|
|
123931
124041
|
state.possibleNewAccounts.add(account);
|
|
@@ -124594,24 +124704,49 @@ class src_client_VoteHash extends src_client_BufferStorage {
|
|
|
124594
124704
|
}
|
|
124595
124705
|
client_VoteHash = src_client_VoteHash;
|
|
124596
124706
|
client_lib_vote_defineProperty(src_client_VoteHash, "isInstance", client_checkableGenerator(client_VoteHash));
|
|
124707
|
+
const client_singleFeeEntrySchema = [client_ValidateASN1.IsBoolean, client_ValidateASN1.IsInteger, {
|
|
124708
|
+
optional: {
|
|
124709
|
+
type: 'context',
|
|
124710
|
+
value: 0,
|
|
124711
|
+
kind: 'implicit',
|
|
124712
|
+
contains: client_ValidateASN1.IsOctetString
|
|
124713
|
+
}
|
|
124714
|
+
}, {
|
|
124715
|
+
optional: {
|
|
124716
|
+
type: 'context',
|
|
124717
|
+
value: 1,
|
|
124718
|
+
kind: 'implicit',
|
|
124719
|
+
contains: client_ValidateASN1.IsOctetString
|
|
124720
|
+
}
|
|
124721
|
+
}];
|
|
124722
|
+
const client_multipleFeeEntrySchema = {
|
|
124723
|
+
type: 'context',
|
|
124724
|
+
value: 0,
|
|
124725
|
+
kind: 'explicit',
|
|
124726
|
+
contains: {
|
|
124727
|
+
sequenceOf: client_singleFeeEntrySchema
|
|
124728
|
+
}
|
|
124729
|
+
};
|
|
124597
124730
|
const client_feeExtensionSchema = {
|
|
124598
124731
|
type: 'context',
|
|
124599
124732
|
value: 0,
|
|
124600
124733
|
kind: 'explicit',
|
|
124601
|
-
contains:
|
|
124602
|
-
|
|
124603
|
-
|
|
124604
|
-
|
|
124605
|
-
|
|
124606
|
-
|
|
124607
|
-
|
|
124608
|
-
|
|
124609
|
-
|
|
124610
|
-
|
|
124611
|
-
|
|
124612
|
-
|
|
124613
|
-
|
|
124614
|
-
|
|
124734
|
+
contains: {
|
|
124735
|
+
choice: [client_singleFeeEntrySchema, client_multipleFeeEntrySchema]
|
|
124736
|
+
}
|
|
124737
|
+
};
|
|
124738
|
+
|
|
124739
|
+
/**
|
|
124740
|
+
* Exported to use in tests but not needed externally
|
|
124741
|
+
* @internal
|
|
124742
|
+
*/
|
|
124743
|
+
|
|
124744
|
+
const client_hashDataSchema = {
|
|
124745
|
+
type: 'context',
|
|
124746
|
+
value: 0,
|
|
124747
|
+
kind: 'explicit',
|
|
124748
|
+
contains: [client_ValidateASN1.IsOID, {
|
|
124749
|
+
sequenceOf: client_ValidateASN1.IsOctetString
|
|
124615
124750
|
}]
|
|
124616
124751
|
};
|
|
124617
124752
|
/**
|
|
@@ -124693,36 +124828,21 @@ function client_blockHashesFromVote(input) {
|
|
|
124693
124828
|
}
|
|
124694
124829
|
return output;
|
|
124695
124830
|
}
|
|
124696
|
-
function
|
|
124697
|
-
const
|
|
124698
|
-
|
|
124699
|
-
const feeInformation = function () {
|
|
124700
|
-
try {
|
|
124701
|
-
return feeSchemaChecker.validate(feeInformationAnyJS);
|
|
124702
|
-
} catch (asn1ValidateError) {
|
|
124703
|
-
let message = 'internal error: fee asn1 schema is not the right format';
|
|
124704
|
-
if (asn1ValidateError instanceof Error) {
|
|
124705
|
-
message = `${message}: ${asn1ValidateError.message}`;
|
|
124706
|
-
}
|
|
124707
|
-
throw new src_client_KeetaNetVoteError('VOTE_MALFORMED_FEES_FROM_VOTE_INVALID_INPUT', message);
|
|
124708
|
-
}
|
|
124709
|
-
}();
|
|
124710
|
-
const feeData = feeInformation.contains;
|
|
124711
|
-
const quote = feeData[0];
|
|
124712
|
-
const retval = {
|
|
124713
|
-
quote: quote,
|
|
124714
|
-
fee: {
|
|
124715
|
-
amount: feeData[1]
|
|
124716
|
-
}
|
|
124831
|
+
function client_parseSingleFeeEntry(feeData) {
|
|
124832
|
+
const fee = {
|
|
124833
|
+
amount: feeData[1]
|
|
124717
124834
|
};
|
|
124835
|
+
if (fee.amount < 0n) {
|
|
124836
|
+
throw new src_client_KeetaNetVoteError('VOTE_MALFORMED_FEES_AMOUNT', 'internal error: fee amount cannot be negative');
|
|
124837
|
+
}
|
|
124718
124838
|
const payToAsn1 = feeData[2];
|
|
124719
124839
|
if (payToAsn1 !== undefined) {
|
|
124720
124840
|
const payTo = client_lib_account.fromPublicKeyAndType(client_vote_Buffer.from(payToAsn1.contains));
|
|
124721
124841
|
if (payTo.isStorage()) {
|
|
124722
|
-
|
|
124842
|
+
fee.payTo = payTo;
|
|
124723
124843
|
} else {
|
|
124724
124844
|
try {
|
|
124725
|
-
|
|
124845
|
+
fee.payTo = payTo.assertAccount();
|
|
124726
124846
|
} catch {
|
|
124727
124847
|
throw new src_client_KeetaNetVoteError('VOTE_MALFORMED_FEES_PAY_TO_INVALID', 'internal error: payTo is not an Account or Storage Address');
|
|
124728
124848
|
}
|
|
@@ -124734,9 +124854,66 @@ function client_feeFromVote(input) {
|
|
|
124734
124854
|
if (!token.isToken()) {
|
|
124735
124855
|
throw new src_client_KeetaNetVoteError('VOTE_MALFORMED_FEES_TOKEN_NOT_TOKEN', 'internal error: fees extension token is not a valid token');
|
|
124736
124856
|
}
|
|
124737
|
-
|
|
124857
|
+
fee.token = token;
|
|
124858
|
+
}
|
|
124859
|
+
return fee;
|
|
124860
|
+
}
|
|
124861
|
+
function client_feeFromVote(input) {
|
|
124862
|
+
const feeInformationAnyJS = client_ASN1toJS(client_bufferToArrayBuffer(input));
|
|
124863
|
+
const feeSchemaChecker = new client_ValidateASN1(client_feeExtensionSchema);
|
|
124864
|
+
const feeInformation = function () {
|
|
124865
|
+
try {
|
|
124866
|
+
return feeSchemaChecker.validate(feeInformationAnyJS);
|
|
124867
|
+
} catch (asn1ValidateError) {
|
|
124868
|
+
let message = 'internal error: fee asn1 schema is not the right format';
|
|
124869
|
+
if (asn1ValidateError instanceof Error) {
|
|
124870
|
+
message = `${message}: ${asn1ValidateError.message}`;
|
|
124871
|
+
}
|
|
124872
|
+
throw new src_client_KeetaNetVoteError('VOTE_MALFORMED_FEES_FROM_VOTE_INVALID_INPUT', message);
|
|
124873
|
+
}
|
|
124874
|
+
}();
|
|
124875
|
+
const feeData = feeInformation.contains;
|
|
124876
|
+
|
|
124877
|
+
/**
|
|
124878
|
+
* Detect format: check if single fee entry (array of attributes) or multiple fee format (context object)
|
|
124879
|
+
* We've already validated the object against the schema so we know it's one or the other
|
|
124880
|
+
*/
|
|
124881
|
+
if (Array.isArray(feeData)) {
|
|
124882
|
+
const quote = feeData[0];
|
|
124883
|
+
const fee = client_parseSingleFeeEntry(feeData);
|
|
124884
|
+
return {
|
|
124885
|
+
quote: quote,
|
|
124886
|
+
fee: fee
|
|
124887
|
+
};
|
|
124888
|
+
} else {
|
|
124889
|
+
// New array format - explicit sequence of fee entries
|
|
124890
|
+
const multiFeeData = feeData.contains;
|
|
124891
|
+
if (multiFeeData.length === 0) {
|
|
124892
|
+
throw new src_client_KeetaNetVoteError('VOTE_MALFORMED_FEES_MULTIPLE_FEE_EMPTY', 'internal error: multiple fee entries must not be an empty array');
|
|
124893
|
+
}
|
|
124894
|
+
const feeList = [];
|
|
124895
|
+
let quote;
|
|
124896
|
+
for (const entry of multiFeeData) {
|
|
124897
|
+
// Schema already validated, but need to narrow the type
|
|
124898
|
+
if (!Array.isArray(entry)) {
|
|
124899
|
+
throw new src_client_KeetaNetVoteError('VOTE_MALFORMED_FEES_FROM_VOTE_INVALID_INPUT', 'internal error: each fee entry must be a Sequence');
|
|
124900
|
+
}
|
|
124901
|
+
const entryQuote = entry[0];
|
|
124902
|
+
if (quote === undefined) {
|
|
124903
|
+
quote = entryQuote;
|
|
124904
|
+
} else if (quote !== entryQuote) {
|
|
124905
|
+
throw new src_client_KeetaNetVoteError('VOTE_MALFORMED_FEES_INVALID_QUOTE_VALUE', 'internal error: all fee entries must have the same quote value');
|
|
124906
|
+
}
|
|
124907
|
+
feeList.push(client_parseSingleFeeEntry(entry));
|
|
124908
|
+
}
|
|
124909
|
+
if (quote === undefined) {
|
|
124910
|
+
throw new src_client_KeetaNetVoteError('VOTE_MALFORMED_FEES_INVALID_QUOTE_VALUE', 'internal error: quote value should not be undefined');
|
|
124911
|
+
}
|
|
124912
|
+
return {
|
|
124913
|
+
quote: quote,
|
|
124914
|
+
fee: feeList
|
|
124915
|
+
};
|
|
124738
124916
|
}
|
|
124739
|
-
return retval;
|
|
124740
124917
|
}
|
|
124741
124918
|
|
|
124742
124919
|
/**
|
|
@@ -124900,14 +125077,22 @@ class src_client_VoteLikeBase {
|
|
|
124900
125077
|
if (fee === undefined) {
|
|
124901
125078
|
return false;
|
|
124902
125079
|
}
|
|
124903
|
-
|
|
124904
|
-
|
|
124905
|
-
|
|
124906
|
-
if (
|
|
125080
|
+
// Handle both single fee and list of fee choices
|
|
125081
|
+
const feeList = Array.isArray(fee) ? fee : [fee];
|
|
125082
|
+
// Reject empty fee arrays to avoid downstream encoding/decoding issues
|
|
125083
|
+
if (feeList.length === 0) {
|
|
124907
125084
|
return false;
|
|
124908
125085
|
}
|
|
124909
|
-
|
|
124910
|
-
|
|
125086
|
+
for (const feeEntry of feeList) {
|
|
125087
|
+
if (feeEntry['amount'] === undefined) {
|
|
125088
|
+
return false;
|
|
125089
|
+
}
|
|
125090
|
+
if ('payTo' in feeEntry && feeEntry['payTo'] === undefined) {
|
|
125091
|
+
return false;
|
|
125092
|
+
}
|
|
125093
|
+
if ('token' in feeEntry && feeEntry['token'] === undefined) {
|
|
125094
|
+
return false;
|
|
125095
|
+
}
|
|
124911
125096
|
}
|
|
124912
125097
|
}
|
|
124913
125098
|
if ('quote' in voteJSON) {
|
|
@@ -124920,7 +125105,7 @@ class src_client_VoteLikeBase {
|
|
|
124920
125105
|
static fromJSON(voteJSON) {
|
|
124921
125106
|
var _voteJSON$quote;
|
|
124922
125107
|
let options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
124923
|
-
if (!
|
|
125108
|
+
if (!this.isValidJSON(voteJSON)) {
|
|
124924
125109
|
throw new src_client_KeetaNetVoteError('VOTE_INVALID_CONSTRUCTION_JSON', 'Cannot construct vote, it is not a valid vote JSON object');
|
|
124925
125110
|
}
|
|
124926
125111
|
const issuer = client_lib_account.toAccount(voteJSON.issuer);
|
|
@@ -124995,8 +125180,8 @@ class src_client_VoteLikeBase {
|
|
|
124995
125180
|
vote = client_bufferToArrayBuffer(vote);
|
|
124996
125181
|
}
|
|
124997
125182
|
if (!client_util.types.isArrayBuffer(vote)) {
|
|
124998
|
-
if (
|
|
124999
|
-
vote =
|
|
125183
|
+
if (this.getClass().isValidJSON(vote)) {
|
|
125184
|
+
vote = this.getClass().fromJSON(vote).toBytes();
|
|
125000
125185
|
} else {
|
|
125001
125186
|
throw new src_client_KeetaNetVoteError('VOTE_INVALID_CONSTRUCTION', 'internal error: invalid vote constructor argument in VoteLikeBase');
|
|
125002
125187
|
}
|
|
@@ -125115,14 +125300,14 @@ class src_client_VoteLikeBase {
|
|
|
125115
125300
|
* Votes must not be expired
|
|
125116
125301
|
*/
|
|
125117
125302
|
const expirationCheckMomentISO = new Date(expirationCheckMoment).toISOString();
|
|
125118
|
-
if (expirationCheckMoment < this.validityFrom.valueOf() -
|
|
125303
|
+
if (expirationCheckMoment < this.validityFrom.valueOf() - this.getClass().allowedSlop) {
|
|
125119
125304
|
throw new src_client_KeetaNetVoteError('VOTE_MOMENT_BEFORE_VALIDITY_FROM', `Vote was issued in the future (issued on ${validFrom.toISOString()}; moment: ${expirationCheckMomentISO})`);
|
|
125120
125305
|
}
|
|
125121
125306
|
|
|
125122
125307
|
/**
|
|
125123
125308
|
* If the vote is forever viable, it is a permanent vote
|
|
125124
125309
|
*/
|
|
125125
|
-
if (this.validityTo.valueOf() > expirationCheckMoment +
|
|
125310
|
+
if (this.validityTo.valueOf() > expirationCheckMoment + this.getClass().permanentVoteThreshold) {
|
|
125126
125311
|
this.$permanent = true;
|
|
125127
125312
|
}
|
|
125128
125313
|
|
|
@@ -125397,7 +125582,7 @@ class src_client_VoteLikeBase {
|
|
|
125397
125582
|
const now = this.expirationCheckMoment();
|
|
125398
125583
|
const from = this.validityFrom.valueOf();
|
|
125399
125584
|
const to = this.validityTo.valueOf();
|
|
125400
|
-
if (now +
|
|
125585
|
+
if (now + this.getClass().allowedSlop < from || now - this.getClass().allowedSlop > to) {
|
|
125401
125586
|
return true;
|
|
125402
125587
|
}
|
|
125403
125588
|
return false;
|
|
@@ -126053,10 +126238,12 @@ client_lib_vote_defineProperty(src_client_VoteStaple, "isInstance", client_check
|
|
|
126053
126238
|
var client_account = /*#__PURE__*/new WeakMap();
|
|
126054
126239
|
var client_blocks2 = /*#__PURE__*/new WeakMap();
|
|
126055
126240
|
var client_fee = /*#__PURE__*/new WeakMap();
|
|
126241
|
+
var client_BaseVoteBuilder_brand = /*#__PURE__*/new WeakSet();
|
|
126056
126242
|
class src_client_BaseVoteBuilder {
|
|
126057
126243
|
constructor(account) {
|
|
126058
126244
|
let blocks = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
|
|
126059
126245
|
let options = arguments.length > 2 ? arguments[2] : undefined;
|
|
126246
|
+
client_vote_classPrivateMethodInitSpec(this, client_BaseVoteBuilder_brand);
|
|
126060
126247
|
client_vote_classPrivateFieldInitSpec(this, client_account, void 0);
|
|
126061
126248
|
client_vote_classPrivateFieldInitSpec(this, client_blocks2, void 0);
|
|
126062
126249
|
client_vote_classPrivateFieldInitSpec(this, client_fee, undefined);
|
|
@@ -126089,26 +126276,21 @@ class src_client_BaseVoteBuilder {
|
|
|
126089
126276
|
this.addBlocks([block]);
|
|
126090
126277
|
}
|
|
126091
126278
|
addFee(feeInput) {
|
|
126092
|
-
|
|
126093
|
-
|
|
126094
|
-
|
|
126095
|
-
const payTo = client_lib_account.toAccount(feeInput.payTo);
|
|
126096
|
-
if (payTo !== undefined) {
|
|
126097
|
-
if (payTo.isStorage()) {
|
|
126098
|
-
fee.payTo = payTo;
|
|
126099
|
-
} else {
|
|
126100
|
-
fee.payTo = payTo.assertAccount();
|
|
126279
|
+
if (Array.isArray(feeInput)) {
|
|
126280
|
+
if (feeInput.length === 0) {
|
|
126281
|
+
throw new src_client_KeetaNetVoteError('VOTE_BUILDER_INVALID_FEE', 'Fee array cannot be empty');
|
|
126101
126282
|
}
|
|
126102
|
-
|
|
126103
|
-
|
|
126104
|
-
|
|
126105
|
-
|
|
126106
|
-
fee.token = token;
|
|
126107
|
-
} else {
|
|
126108
|
-
throw new src_client_KeetaNetVoteError('VOTE_MALFORMED_FEES_TOKEN_NOT_TOKEN', 'Fee Token should be of type TOKEN');
|
|
126283
|
+
// List of fee choices format (array)
|
|
126284
|
+
const feeList = [];
|
|
126285
|
+
for (const feeEntry of feeInput) {
|
|
126286
|
+
feeList.push(client_vote_assertClassBrand(client_BaseVoteBuilder_brand, this, client_formatSingleFeeEntry).call(this, feeEntry));
|
|
126109
126287
|
}
|
|
126288
|
+
client_vote_classPrivateFieldSet(client_fee, this, feeList);
|
|
126289
|
+
} else {
|
|
126290
|
+
// Single fee
|
|
126291
|
+
const fee = client_vote_assertClassBrand(client_BaseVoteBuilder_brand, this, client_formatSingleFeeEntry).call(this, feeInput);
|
|
126292
|
+
client_vote_classPrivateFieldSet(client_fee, this, fee);
|
|
126110
126293
|
}
|
|
126111
|
-
client_vote_classPrivateFieldSet(client_fee, this, fee);
|
|
126112
126294
|
}
|
|
126113
126295
|
generateVoteData(serial, validTo, validFrom) {
|
|
126114
126296
|
/**
|
|
@@ -126154,30 +126336,22 @@ class src_client_BaseVoteBuilder {
|
|
|
126154
126336
|
}];
|
|
126155
126337
|
let feeExtension = undefined;
|
|
126156
126338
|
if (client_vote_classPrivateFieldGet(client_fee, this) !== undefined) {
|
|
126157
|
-
|
|
126158
|
-
|
|
126159
|
-
|
|
126160
|
-
|
|
126161
|
-
|
|
126162
|
-
|
|
126163
|
-
|
|
126164
|
-
|
|
126339
|
+
let feeDataContent;
|
|
126340
|
+
if (Array.isArray(client_vote_classPrivateFieldGet(client_fee, this))) {
|
|
126341
|
+
// List of fee choices format (array)
|
|
126342
|
+
const feeDataArray = [];
|
|
126343
|
+
for (const fee of client_vote_classPrivateFieldGet(client_fee, this)) {
|
|
126344
|
+
feeDataArray.push(client_vote_assertClassBrand(client_BaseVoteBuilder_brand, this, client_formatSingleFeeEntryData).call(this, fee));
|
|
126345
|
+
}
|
|
126346
|
+
feeDataContent = {
|
|
126165
126347
|
type: 'context',
|
|
126166
126348
|
value: 0,
|
|
126167
|
-
kind: '
|
|
126168
|
-
contains:
|
|
126169
|
-
}
|
|
126170
|
-
}
|
|
126171
|
-
|
|
126172
|
-
|
|
126173
|
-
const tokenPublicKey = (_classPrivateFieldGet4 = client_vote_classPrivateFieldGet(client_fee, this).token) === null || _classPrivateFieldGet4 === void 0 ? void 0 : _classPrivateFieldGet4.publicKeyAndType;
|
|
126174
|
-
if (tokenPublicKey !== undefined) {
|
|
126175
|
-
feeData.push({
|
|
126176
|
-
type: 'context',
|
|
126177
|
-
value: 1,
|
|
126178
|
-
kind: 'implicit',
|
|
126179
|
-
contains: tokenPublicKey
|
|
126180
|
-
});
|
|
126349
|
+
kind: 'explicit',
|
|
126350
|
+
contains: feeDataArray
|
|
126351
|
+
};
|
|
126352
|
+
} else {
|
|
126353
|
+
// Single fee format
|
|
126354
|
+
feeDataContent = client_vote_assertClassBrand(client_BaseVoteBuilder_brand, this, client_formatSingleFeeEntryData).call(this, client_vote_classPrivateFieldGet(client_fee, this));
|
|
126181
126355
|
}
|
|
126182
126356
|
feeExtension = [{
|
|
126183
126357
|
type: 'oid',
|
|
@@ -126188,7 +126362,7 @@ class src_client_BaseVoteBuilder {
|
|
|
126188
126362
|
type: 'context',
|
|
126189
126363
|
value: 0,
|
|
126190
126364
|
kind: 'explicit',
|
|
126191
|
-
contains:
|
|
126365
|
+
contains: feeDataContent
|
|
126192
126366
|
}).toBER(false))];
|
|
126193
126367
|
}
|
|
126194
126368
|
|
|
@@ -126348,6 +126522,53 @@ class src_client_BaseVoteBuilder {
|
|
|
126348
126522
|
}
|
|
126349
126523
|
}
|
|
126350
126524
|
client_BaseVoteBuilder = src_client_BaseVoteBuilder;
|
|
126525
|
+
function client_formatSingleFeeEntry(feeInput) {
|
|
126526
|
+
const fee = {
|
|
126527
|
+
amount: BigInt(feeInput.amount)
|
|
126528
|
+
};
|
|
126529
|
+
const payTo = client_lib_account.toAccount(feeInput.payTo);
|
|
126530
|
+
if (payTo !== undefined) {
|
|
126531
|
+
if (payTo.isStorage()) {
|
|
126532
|
+
fee.payTo = payTo;
|
|
126533
|
+
} else {
|
|
126534
|
+
fee.payTo = payTo.assertAccount();
|
|
126535
|
+
}
|
|
126536
|
+
}
|
|
126537
|
+
const token = client_lib_account.toAccount(feeInput.token);
|
|
126538
|
+
if (token !== undefined) {
|
|
126539
|
+
if (token.isToken()) {
|
|
126540
|
+
fee.token = token;
|
|
126541
|
+
} else {
|
|
126542
|
+
throw new src_client_KeetaNetVoteError('VOTE_MALFORMED_FEES_TOKEN_NOT_TOKEN', 'Fee Token should be of type TOKEN');
|
|
126543
|
+
}
|
|
126544
|
+
}
|
|
126545
|
+
return fee;
|
|
126546
|
+
}
|
|
126547
|
+
function client_formatSingleFeeEntryData(feeInput) {
|
|
126548
|
+
var _feeInput$payTo, _feeInput$token;
|
|
126549
|
+
/** Account to pay the fee too */
|
|
126550
|
+
let payToData = undefined;
|
|
126551
|
+
if (((_feeInput$payTo = feeInput.payTo) === null || _feeInput$payTo === void 0 ? void 0 : _feeInput$payTo.publicKeyAndType) !== undefined) {
|
|
126552
|
+
payToData = {
|
|
126553
|
+
type: 'context',
|
|
126554
|
+
value: 0,
|
|
126555
|
+
kind: 'implicit',
|
|
126556
|
+
contains: feeInput.payTo.publicKeyAndType
|
|
126557
|
+
};
|
|
126558
|
+
}
|
|
126559
|
+
|
|
126560
|
+
/** Token in which to pay the fee */
|
|
126561
|
+
let tokenData = undefined;
|
|
126562
|
+
if (((_feeInput$token = feeInput.token) === null || _feeInput$token === void 0 ? void 0 : _feeInput$token.publicKeyAndType) !== undefined) {
|
|
126563
|
+
tokenData = {
|
|
126564
|
+
type: 'context',
|
|
126565
|
+
value: 1,
|
|
126566
|
+
kind: 'implicit',
|
|
126567
|
+
contains: feeInput.token.publicKeyAndType
|
|
126568
|
+
};
|
|
126569
|
+
}
|
|
126570
|
+
return [this.quote, feeInput.amount, payToData, tokenData];
|
|
126571
|
+
}
|
|
126351
126572
|
client_lib_vote_defineProperty(src_client_BaseVoteBuilder, "isInstance", client_checkableGenerator(client_BaseVoteBuilder));
|
|
126352
126573
|
class src_client_VoteBuilder extends src_client_BaseVoteBuilder {
|
|
126353
126574
|
async seal(serial, validTo, validFrom) {
|
|
@@ -126385,8 +126606,63 @@ src_client_Vote.Quote = src_client_VoteQuote;
|
|
|
126385
126606
|
const src_client_Testing = {
|
|
126386
126607
|
findRDN: client_findRDN,
|
|
126387
126608
|
blockHashesFromVote: client_blockHashesFromVote,
|
|
126388
|
-
feeFromVote: client_feeFromVote
|
|
126609
|
+
feeFromVote: client_feeFromVote,
|
|
126610
|
+
hashDataSchema: client_hashDataSchema,
|
|
126611
|
+
feeExtensionSchema: client_feeExtensionSchema
|
|
126389
126612
|
};
|
|
126613
|
+
;// ./src/lib/ledger/types.ts
|
|
126614
|
+
/**
|
|
126615
|
+
* Account info entry
|
|
126616
|
+
*/
|
|
126617
|
+
|
|
126618
|
+
// For some reason, if we do not have these types for each key pair type, TypeScript does not properly discriminate the union when we use Extract
|
|
126619
|
+
// Ex: KeyPairAccountInfo extends BaseAccountInfo<KeyPairKeyAlgorithm> {} does not work, we have to declare each individually
|
|
126620
|
+
// eslint-disable-next-line @typescript-eslint/no-empty-object-type
|
|
126621
|
+
|
|
126622
|
+
// eslint-disable-next-line @typescript-eslint/no-empty-object-type
|
|
126623
|
+
|
|
126624
|
+
// eslint-disable-next-line @typescript-eslint/no-empty-object-type
|
|
126625
|
+
|
|
126626
|
+
// eslint-disable-next-line @typescript-eslint/no-empty-object-type
|
|
126627
|
+
|
|
126628
|
+
// eslint-disable-next-line @typescript-eslint/no-empty-object-type
|
|
126629
|
+
|
|
126630
|
+
// eslint-disable-next-line @typescript-eslint/no-empty-object-type
|
|
126631
|
+
|
|
126632
|
+
// This is a type-level check to ensure that we have defined AccountInfoForType for all AccountKeyAlgorithm types, so that the type guard function works properly
|
|
126633
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
126634
|
+
|
|
126635
|
+
function client_isIdentifierAccountInfo(info) {
|
|
126636
|
+
return info.account.isIdentifier();
|
|
126637
|
+
}
|
|
126638
|
+
function client_isKeyPairAccountInfo(info) {
|
|
126639
|
+
return info.account.isAccount();
|
|
126640
|
+
}
|
|
126641
|
+
function client_isAccountInfoOfType(info, type) {
|
|
126642
|
+
return info.account.isKeyType(type);
|
|
126643
|
+
}
|
|
126644
|
+
|
|
126645
|
+
/**
|
|
126646
|
+
* Permissions types
|
|
126647
|
+
*/
|
|
126648
|
+
|
|
126649
|
+
/**
|
|
126650
|
+
* An entry for the ACL
|
|
126651
|
+
* @expandType ACLRow
|
|
126652
|
+
*/
|
|
126653
|
+
|
|
126654
|
+
/**
|
|
126655
|
+
* Update an ACL for an account
|
|
126656
|
+
* @expandType ACLEntry
|
|
126657
|
+
*/
|
|
126658
|
+
|
|
126659
|
+
/**
|
|
126660
|
+
* All balances for each token on an account
|
|
126661
|
+
*/
|
|
126662
|
+
|
|
126663
|
+
/**
|
|
126664
|
+
* Ledger statistics
|
|
126665
|
+
*/
|
|
126390
126666
|
;// ./src/lib/ledger/cache.ts
|
|
126391
126667
|
/* provided dependency */ var client_cache_Buffer = __webpack_require__(8287)["Buffer"];
|
|
126392
126668
|
function client_cache_classPrivateFieldInitSpec(e, t, a) { client_cache_checkPrivateRedeclaration(e, t), t.set(e, a); }
|
|
@@ -127697,6 +127973,7 @@ function client_lib_ledger_toPrimitive(t, r) { if ("object" != typeof t || !t) r
|
|
|
127697
127973
|
|
|
127698
127974
|
|
|
127699
127975
|
|
|
127976
|
+
|
|
127700
127977
|
/**
|
|
127701
127978
|
* Kind of ledger
|
|
127702
127979
|
*/
|
|
@@ -127976,31 +128253,45 @@ class client_LedgerAtomicInterface {
|
|
|
127976
128253
|
if (!hasFeeBlock) {
|
|
127977
128254
|
throw new client_ledger_KeetaNetLedgerError('LEDGER_MISSING_REQUIRED_FEE_BLOCK', 'Missing fee block but votes require it');
|
|
127978
128255
|
}
|
|
128256
|
+
// Each vote requires exactly one fee payment, regardless of array size
|
|
127979
128257
|
if (requiredFees.size !== (possibleFeeBlock === null || possibleFeeBlock === void 0 ? void 0 : possibleFeeBlock.operations.length)) {
|
|
127980
128258
|
throw new client_ledger_KeetaNetLedgerError('LEDGER_REQUIRED_FEE_MISMATCH', 'Fee Block Operations do not match required fees');
|
|
127981
128259
|
}
|
|
127982
128260
|
}
|
|
127983
128261
|
|
|
127984
|
-
// Verify that
|
|
127985
|
-
for (const [issuer,
|
|
127986
|
-
|
|
128262
|
+
// Verify that at least one required fee option has been satisfied for each vote
|
|
128263
|
+
for (const [issuer, feeOrFees] of requiredFees) {
|
|
128264
|
+
// Handle both single fee and array of fees
|
|
128265
|
+
const fees = Array.isArray(feeOrFees) ? feeOrFees : [feeOrFees];
|
|
128266
|
+
|
|
128267
|
+
// Check if at least one fee option is satisfied
|
|
128268
|
+
let foundMatchingFee = false;
|
|
128269
|
+
for (const fee of fees) {
|
|
127987
128270
|
var _fee$payTo, _fee$token;
|
|
127988
128271
|
const expectedPayTo = (_fee$payTo = fee.payTo) !== null && _fee$payTo !== void 0 ? _fee$payTo : issuer;
|
|
127989
128272
|
const expectedToken = (_fee$token = fee.token) !== null && _fee$token !== void 0 ? _fee$token : client_ledger_classPrivateFieldGet(client_ledger, this).baseToken;
|
|
127990
|
-
|
|
127991
|
-
if (operation.
|
|
127992
|
-
|
|
127993
|
-
|
|
127994
|
-
|
|
127995
|
-
throw new client_ledger_KeetaNetLedgerError('LEDGER_FEE_TOKEN_MISMATCH', `Fee Token Mismatch, found: ${operation.token.publicKeyString.get()} expected: ${expectedToken.publicKeyString.get()}`);
|
|
128273
|
+
const foundFee = possibleFeeBlock === null || possibleFeeBlock === void 0 ? void 0 : possibleFeeBlock.operations.find(operation => {
|
|
128274
|
+
if (operation.type === client_OperationType.SEND && operation.to.comparePublicKey(expectedPayTo)) {
|
|
128275
|
+
if (operation.amount === fee.amount && operation.token.comparePublicKey(expectedToken)) {
|
|
128276
|
+
return true;
|
|
128277
|
+
}
|
|
127996
128278
|
}
|
|
127997
|
-
return
|
|
128279
|
+
return false;
|
|
128280
|
+
});
|
|
128281
|
+
if (foundFee !== undefined) {
|
|
128282
|
+
foundMatchingFee = true;
|
|
128283
|
+
break; // Found a matching fee, no need to check others
|
|
127998
128284
|
}
|
|
127999
|
-
|
|
128000
|
-
|
|
128001
|
-
|
|
128002
|
-
|
|
128003
|
-
|
|
128285
|
+
}
|
|
128286
|
+
if (!foundMatchingFee) {
|
|
128287
|
+
// Build helpful error message showing what fees were expected
|
|
128288
|
+
const feeOptions = fees.map(fee => {
|
|
128289
|
+
var _fee$payTo2, _fee$token2;
|
|
128290
|
+
const payTo = (_fee$payTo2 = fee.payTo) !== null && _fee$payTo2 !== void 0 ? _fee$payTo2 : issuer;
|
|
128291
|
+
const token = (_fee$token2 = fee.token) !== null && _fee$token2 !== void 0 ? _fee$token2 : client_ledger_classPrivateFieldGet(client_ledger, this).baseToken;
|
|
128292
|
+
return `${fee.amount} ${token.publicKeyString.get()} to ${payTo.publicKeyString.get()}`;
|
|
128293
|
+
}).join(' OR ');
|
|
128294
|
+
throw new client_ledger_KeetaNetLedgerError('LEDGER_FEE_MISSING', `Missing Required Fee for ${issuer.publicKeyString.get()}. Expected one of: ${feeOptions}`);
|
|
128004
128295
|
}
|
|
128005
128296
|
}
|
|
128006
128297
|
} else if (outcome === 'temporary') {
|
|
@@ -128612,14 +128903,14 @@ async function client_checkSingleAccountPermissions(account, requirements, accou
|
|
|
128612
128903
|
const entityAccounts = new client_lib_account.Set(unfilteredEntity).toArray();
|
|
128613
128904
|
const gotPermissions = await this.listACLsByPrincipal(account, entityAccounts);
|
|
128614
128905
|
for (const requirement of requirements) {
|
|
128615
|
-
var _accountInfos$reqEnti;
|
|
128616
128906
|
const reqEntityKey = requirement.entity.publicKeyString.get();
|
|
128617
128907
|
const foundACLRow = client_findPermissionMatch(requirement, gotPermissions);
|
|
128908
|
+
const foundAccountInfo = accountInfos[reqEntityKey];
|
|
128618
128909
|
let foundPermission;
|
|
128619
128910
|
if (foundACLRow !== null && foundACLRow !== void 0 && foundACLRow.permissions) {
|
|
128620
128911
|
foundPermission = foundACLRow === null || foundACLRow === void 0 ? void 0 : foundACLRow.permissions;
|
|
128621
|
-
} else if (
|
|
128622
|
-
foundPermission =
|
|
128912
|
+
} else if (foundAccountInfo && client_isIdentifierAccountInfo(foundAccountInfo) && foundAccountInfo.defaultPermission) {
|
|
128913
|
+
foundPermission = foundAccountInfo.defaultPermission;
|
|
128623
128914
|
} else {
|
|
128624
128915
|
foundPermission = new client_permissions_Permissions();
|
|
128625
128916
|
}
|
|
@@ -128688,7 +128979,7 @@ async function client_checkPermissionRequirements(effects) {
|
|
|
128688
128979
|
for (const [multisig, foundSingerLength] of foundMultisigSignerLengths) {
|
|
128689
128980
|
const multisigPubKey = multisig.publicKeyString.get();
|
|
128690
128981
|
const foundInfo = foundAccountInfo[multisigPubKey];
|
|
128691
|
-
if (!(foundInfo !== null && foundInfo !== void 0 && foundInfo.multisigQuorum)) {
|
|
128982
|
+
if (!('multisigQuorum' in foundInfo) || !(foundInfo !== null && foundInfo !== void 0 && foundInfo.multisigQuorum)) {
|
|
128692
128983
|
throw new Error(`Multisig quorum not found for ${multisigPubKey}`);
|
|
128693
128984
|
}
|
|
128694
128985
|
if (foundInfo.multisigQuorum > foundSingerLength) {
|
|
@@ -129318,97 +129609,94 @@ class src_client_Ledger {
|
|
|
129318
129609
|
return await transaction.getAccountRep(...args);
|
|
129319
129610
|
});
|
|
129320
129611
|
}
|
|
129321
|
-
async getAccountInfo() {
|
|
129322
|
-
for (var _len15 = arguments.length, args = new Array(_len15), _key15 = 0; _key15 < _len15; _key15++) {
|
|
129323
|
-
args[_key15] = arguments[_key15];
|
|
129324
|
-
}
|
|
129612
|
+
async getAccountInfo(account) {
|
|
129325
129613
|
return await this.runReadOnly('db-getAccountInfo', async function (transaction) {
|
|
129326
|
-
return await transaction.getAccountInfo(
|
|
129614
|
+
return await transaction.getAccountInfo(account);
|
|
129327
129615
|
});
|
|
129328
129616
|
}
|
|
129329
129617
|
async getBlock() {
|
|
129330
|
-
for (var
|
|
129331
|
-
args[
|
|
129618
|
+
for (var _len15 = arguments.length, args = new Array(_len15), _key15 = 0; _key15 < _len15; _key15++) {
|
|
129619
|
+
args[_key15] = arguments[_key15];
|
|
129332
129620
|
}
|
|
129333
129621
|
return await this.runReadOnly('db-getBlock', async function (transaction) {
|
|
129334
129622
|
return await transaction.getBlock(...args);
|
|
129335
129623
|
});
|
|
129336
129624
|
}
|
|
129337
129625
|
async getAccountsBlockHeightInfo() {
|
|
129338
|
-
for (var
|
|
129339
|
-
args[
|
|
129626
|
+
for (var _len16 = arguments.length, args = new Array(_len16), _key16 = 0; _key16 < _len16; _key16++) {
|
|
129627
|
+
args[_key16] = arguments[_key16];
|
|
129340
129628
|
}
|
|
129341
129629
|
return await this.runReadOnly('db-getAccountsBlockHeightInfo', async function (transaction) {
|
|
129342
129630
|
return await transaction.getAccountsBlockHeightInfo(...args);
|
|
129343
129631
|
});
|
|
129344
129632
|
}
|
|
129345
129633
|
async getVoteStaple() {
|
|
129346
|
-
for (var
|
|
129347
|
-
args[
|
|
129634
|
+
for (var _len17 = arguments.length, args = new Array(_len17), _key17 = 0; _key17 < _len17; _key17++) {
|
|
129635
|
+
args[_key17] = arguments[_key17];
|
|
129348
129636
|
}
|
|
129349
129637
|
return await this.runReadOnly('db-getVoteStaple', async function (transaction) {
|
|
129350
129638
|
return await transaction.getVoteStaple(...args);
|
|
129351
129639
|
});
|
|
129352
129640
|
}
|
|
129353
129641
|
async getVoteStaples() {
|
|
129354
|
-
for (var
|
|
129355
|
-
args[
|
|
129642
|
+
for (var _len18 = arguments.length, args = new Array(_len18), _key18 = 0; _key18 < _len18; _key18++) {
|
|
129643
|
+
args[_key18] = arguments[_key18];
|
|
129356
129644
|
}
|
|
129357
129645
|
return await this.runReadOnly('db-getVoteStaples', async function (transaction) {
|
|
129358
129646
|
return await transaction.getVoteStaples(...args);
|
|
129359
129647
|
});
|
|
129360
129648
|
}
|
|
129361
129649
|
async getHistory() {
|
|
129362
|
-
for (var
|
|
129363
|
-
args[
|
|
129650
|
+
for (var _len19 = arguments.length, args = new Array(_len19), _key19 = 0; _key19 < _len19; _key19++) {
|
|
129651
|
+
args[_key19] = arguments[_key19];
|
|
129364
129652
|
}
|
|
129365
129653
|
return await this.runReadOnly('db-getHistory', async function (transaction) {
|
|
129366
129654
|
return await transaction.getHistory(...args);
|
|
129367
129655
|
});
|
|
129368
129656
|
}
|
|
129369
129657
|
async getStaplesFromBlockHashes() {
|
|
129370
|
-
for (var
|
|
129371
|
-
args[
|
|
129658
|
+
for (var _len20 = arguments.length, args = new Array(_len20), _key20 = 0; _key20 < _len20; _key20++) {
|
|
129659
|
+
args[_key20] = arguments[_key20];
|
|
129372
129660
|
}
|
|
129373
129661
|
return await this.runReadOnly('db-getStaplesFromBlockHashes', async function (transaction) {
|
|
129374
129662
|
return await transaction.getStaplesFromBlockHashes(...args);
|
|
129375
129663
|
});
|
|
129376
129664
|
}
|
|
129377
129665
|
async getVoteStaplesAfter() {
|
|
129378
|
-
for (var
|
|
129379
|
-
args[
|
|
129666
|
+
for (var _len21 = arguments.length, args = new Array(_len21), _key21 = 0; _key21 < _len21; _key21++) {
|
|
129667
|
+
args[_key21] = arguments[_key21];
|
|
129380
129668
|
}
|
|
129381
129669
|
return await this.runReadOnly('db-getVoteStaplesAfter', async function (transaction) {
|
|
129382
129670
|
return await transaction.getVoteStaplesAfter(...args);
|
|
129383
129671
|
});
|
|
129384
129672
|
}
|
|
129385
129673
|
async gc() {
|
|
129386
|
-
for (var
|
|
129387
|
-
args[
|
|
129674
|
+
for (var _len22 = arguments.length, args = new Array(_len22), _key22 = 0; _key22 < _len22; _key22++) {
|
|
129675
|
+
args[_key22] = arguments[_key22];
|
|
129388
129676
|
}
|
|
129389
129677
|
return await this.run('db-gc', async function (transaction) {
|
|
129390
129678
|
return await transaction.gc(...args);
|
|
129391
129679
|
});
|
|
129392
129680
|
}
|
|
129393
129681
|
async getFee() {
|
|
129394
|
-
for (var
|
|
129395
|
-
args[
|
|
129682
|
+
for (var _len23 = arguments.length, args = new Array(_len23), _key23 = 0; _key23 < _len23; _key23++) {
|
|
129683
|
+
args[_key23] = arguments[_key23];
|
|
129396
129684
|
}
|
|
129397
129685
|
return await this.runReadOnly('db-getFee', async function (transaction) {
|
|
129398
129686
|
return await transaction.getFee(...args);
|
|
129399
129687
|
});
|
|
129400
129688
|
}
|
|
129401
129689
|
async getIdempotentBlockHash() {
|
|
129402
|
-
for (var
|
|
129403
|
-
args[
|
|
129690
|
+
for (var _len24 = arguments.length, args = new Array(_len24), _key24 = 0; _key24 < _len24; _key24++) {
|
|
129691
|
+
args[_key24] = arguments[_key24];
|
|
129404
129692
|
}
|
|
129405
129693
|
return await this.runReadOnly('db-getIdempotentBlockHash', async function (transaction) {
|
|
129406
129694
|
return await transaction.getIdempotentBlockHash(...args);
|
|
129407
129695
|
});
|
|
129408
129696
|
}
|
|
129409
129697
|
async getBlockFromIdempotent() {
|
|
129410
|
-
for (var
|
|
129411
|
-
args[
|
|
129698
|
+
for (var _len25 = arguments.length, args = new Array(_len25), _key25 = 0; _key25 < _len25; _key25++) {
|
|
129699
|
+
args[_key25] = arguments[_key25];
|
|
129412
129700
|
}
|
|
129413
129701
|
return await this.runReadOnly('db-getBlockFromIdempotent', async function (transaction) {
|
|
129414
129702
|
return await transaction.getBlockFromIdempotent(...args);
|
|
@@ -129440,7 +129728,7 @@ client_lib_ledger_defineProperty(src_client_Ledger, "isInstance", client_checkab
|
|
|
129440
129728
|
// EXTERNAL MODULE: ws (ignored)
|
|
129441
129729
|
var client_ws_ignored_ = __webpack_require__(4708);
|
|
129442
129730
|
;// ./src/version.ts
|
|
129443
|
-
const client_version = '0.16.
|
|
129731
|
+
const client_version = '0.16.1+g8d5abd1c27152ecca68f2594f9191c1c77a334a4';
|
|
129444
129732
|
/* harmony default export */ const client_src_version = ((/* unused pure expression or super */ null && (client_version)));
|
|
129445
129733
|
;// ./src/lib/p2p.ts
|
|
129446
129734
|
/* provided dependency */ var client_p2p_Buffer = __webpack_require__(8287)["Buffer"];
|
|
@@ -132246,6 +132534,9 @@ class src_client_UserClientBuilder {
|
|
|
132246
132534
|
const [base, external] = operations.info.defaultPermission.map(function (intString) {
|
|
132247
132535
|
return BigInt(intString);
|
|
132248
132536
|
});
|
|
132537
|
+
|
|
132538
|
+
// This is correct as we are constructing this from data that was only set if it was valid
|
|
132539
|
+
// eslint-disable-next-line @typescript-eslint/consistent-type-assertions
|
|
132249
132540
|
newInfo.defaultPermission = new client_permissions_Permissions(base, external);
|
|
132250
132541
|
}
|
|
132251
132542
|
pendingOperations.info = newInfo;
|
|
@@ -132535,12 +132826,33 @@ class src_client_UserClientBuilder {
|
|
|
132535
132826
|
const operations = [];
|
|
132536
132827
|
for (const vote of staple.votes) {
|
|
132537
132828
|
if (vote.fee !== undefined) {
|
|
132538
|
-
var
|
|
132829
|
+
var _selectedFee$payTo, _selectedFee$token;
|
|
132830
|
+
// Handle both single fee and array of fees
|
|
132831
|
+
// Select one fee: prefer one with undefined token (baseToken) or matching baseToken
|
|
132832
|
+
const fees = Array.isArray(vote.fee) ? vote.fee : [vote.fee];
|
|
132833
|
+
|
|
132834
|
+
// If there are no fees, skip this vote
|
|
132835
|
+
if (fees.length === 0) {
|
|
132836
|
+
continue;
|
|
132837
|
+
}
|
|
132838
|
+
|
|
132839
|
+
// Find fee with undefined token or matching baseToken
|
|
132840
|
+
let selectedFee = fees.find(fee => {
|
|
132841
|
+
if (fee.token === undefined || fee.token.comparePublicKey(baseToken)) {
|
|
132842
|
+
return true;
|
|
132843
|
+
}
|
|
132844
|
+
return false;
|
|
132845
|
+
});
|
|
132846
|
+
|
|
132847
|
+
// If no matching fee, use the first one
|
|
132848
|
+
if (!selectedFee) {
|
|
132849
|
+
selectedFee = fees[0];
|
|
132850
|
+
}
|
|
132539
132851
|
operations.push({
|
|
132540
132852
|
type: client_OperationType.SEND,
|
|
132541
|
-
amount:
|
|
132542
|
-
to: (
|
|
132543
|
-
token: (
|
|
132853
|
+
amount: selectedFee.amount,
|
|
132854
|
+
to: (_selectedFee$payTo = selectedFee.payTo) !== null && _selectedFee$payTo !== void 0 ? _selectedFee$payTo : vote.issuer,
|
|
132855
|
+
token: (_selectedFee$token = selectedFee.token) !== null && _selectedFee$token !== void 0 ? _selectedFee$token : baseToken
|
|
132544
132856
|
});
|
|
132545
132857
|
}
|
|
132546
132858
|
}
|
|
@@ -132683,12 +132995,16 @@ class src_client_UserClientBuilder {
|
|
|
132683
132995
|
}
|
|
132684
132996
|
operations.push(...receiveOperations);
|
|
132685
132997
|
if (pending.info) {
|
|
132998
|
+
let defaultPermission;
|
|
132999
|
+
if ('defaultPermission' in pending.info) {
|
|
133000
|
+
defaultPermission = pending.info.defaultPermission;
|
|
133001
|
+
}
|
|
132686
133002
|
operations.push({
|
|
132687
133003
|
type: src_client_Block.OperationType.SET_INFO,
|
|
132688
133004
|
name: pending.info.name,
|
|
132689
133005
|
description: pending.info.description,
|
|
132690
133006
|
metadata: pending.info.metadata,
|
|
132691
|
-
defaultPermission:
|
|
133007
|
+
defaultPermission: defaultPermission
|
|
132692
133008
|
});
|
|
132693
133009
|
}
|
|
132694
133010
|
if (pending.setRep) {
|
|
@@ -133596,9 +133912,10 @@ class src_client_Client {
|
|
|
133596
133912
|
}
|
|
133597
133913
|
});
|
|
133598
133914
|
const parsed = response.access.map(entry => {
|
|
133915
|
+
const entity = client_src_lib.Account.fromPublicKeyString(entry.entity);
|
|
133599
133916
|
return {
|
|
133600
|
-
entity:
|
|
133601
|
-
info: client_client_assertClassBrand(client_Client_brand, this, client_formatAccountInfo).call(this, entry.info),
|
|
133917
|
+
entity: entity,
|
|
133918
|
+
info: client_client_assertClassBrand(client_Client_brand, this, client_formatAccountInfo).call(this, entry.info, entity),
|
|
133602
133919
|
balances: client_client_assertClassBrand(client_Client_brand, this, client_formatAllBalances).call(this, entry.balances),
|
|
133603
133920
|
principals: client_client_assertClassBrand(client_Client_brand, this, client_parsePermissionEntries).call(this, entry.principals)
|
|
133604
133921
|
};
|
|
@@ -134987,22 +135304,34 @@ function client_parseResponsePermissions(permissions) {
|
|
|
134987
135304
|
const [base, external] = permissions.map(val => BigInt(val));
|
|
134988
135305
|
return new client_src_lib.Permissions(base, external);
|
|
134989
135306
|
}
|
|
134990
|
-
function client_formatAccountInfo(raw) {
|
|
134991
|
-
|
|
135307
|
+
function client_formatAccountInfo(raw, account) {
|
|
135308
|
+
let ret = {
|
|
134992
135309
|
name: raw.name,
|
|
134993
135310
|
description: raw.description,
|
|
134994
135311
|
metadata: raw.metadata
|
|
134995
135312
|
};
|
|
134996
|
-
if (
|
|
134997
|
-
|
|
134998
|
-
|
|
134999
|
-
|
|
135000
|
-
|
|
135001
|
-
|
|
135002
|
-
|
|
135003
|
-
|
|
135313
|
+
if (account.isIdentifier()) {
|
|
135314
|
+
ret = {
|
|
135315
|
+
...ret,
|
|
135316
|
+
defaultPermission: raw.defaultPermission !== undefined ? client_client_assertClassBrand(client_Client_brand, this, client_parseResponsePermissions).call(this, raw.defaultPermission) : undefined
|
|
135317
|
+
};
|
|
135318
|
+
if (account.isMultisig()) {
|
|
135319
|
+
if (raw.multisigQuorum !== undefined) {
|
|
135320
|
+
ret = {
|
|
135321
|
+
...ret,
|
|
135322
|
+
multisigQuorum: raw.multisigQuorum !== null ? BigInt(raw.multisigQuorum) : null
|
|
135323
|
+
};
|
|
135324
|
+
}
|
|
135325
|
+
} else if (account.isToken()) {
|
|
135326
|
+
if (raw.supply !== undefined) {
|
|
135327
|
+
ret = {
|
|
135328
|
+
...ret,
|
|
135329
|
+
supply: BigInt(raw.supply)
|
|
135330
|
+
};
|
|
135331
|
+
}
|
|
135332
|
+
}
|
|
135004
135333
|
}
|
|
135005
|
-
return
|
|
135334
|
+
return ret;
|
|
135006
135335
|
}
|
|
135007
135336
|
function client_parseAccountInfo(account, accountInfo) {
|
|
135008
135337
|
account = client_lib_account.toAccount(account);
|
|
@@ -135021,11 +135350,11 @@ function client_parseAccountInfo(account, accountInfo) {
|
|
|
135021
135350
|
currentRepresentative = client_src_lib.Account.fromPublicKeyString(accountInfo.representative).assertAccount();
|
|
135022
135351
|
}
|
|
135023
135352
|
return {
|
|
135024
|
-
account: client_src_lib.Account.fromPublicKeyString(accountInfo.account),
|
|
135353
|
+
account: client_src_lib.Account.fromPublicKeyString(accountInfo.account).assertKeyType(account.keyType),
|
|
135025
135354
|
currentHeadBlock: currentHeadBlock,
|
|
135026
135355
|
currentHeadBlockHeight: accountInfo.currentHeadBlockHeight,
|
|
135027
135356
|
representative: currentRepresentative,
|
|
135028
|
-
info: client_client_assertClassBrand(client_Client_brand, this, client_formatAccountInfo).call(this, accountInfo.info),
|
|
135357
|
+
info: client_client_assertClassBrand(client_Client_brand, this, client_formatAccountInfo).call(this, accountInfo.info, account),
|
|
135029
135358
|
balances: client_client_assertClassBrand(client_Client_brand, this, client_formatAllBalances).call(this, accountInfo.balances)
|
|
135030
135359
|
};
|
|
135031
135360
|
}
|