@polkadot-api/substrate-bindings
Advanced tools
Comparing version 0.9.4 to 0.10.0
@@ -29,2 +29,8 @@ import * as scale_ts from 'scale-ts'; | ||
declare const getMultisigAccountId: ({ threshold, signatories, }: { | ||
threshold: number; | ||
signatories: Uint8Array[]; | ||
}) => Uint8Array; | ||
declare const sortMultisigSignatories: (signatories: Uint8Array[]) => Uint8Array[]; | ||
declare class Binary { | ||
@@ -1104,2 +1110,2 @@ #private; | ||
export { AccountId, Bin, Binary, type BitSequence, Blake2128, Blake2128Concat, Blake2256, Blake3256, Blake3256Concat, type BlockHeader, type EncoderWithHash, Enum, type EnumVariant, type ExtractEnumValue, FixedSizeBinary, type GetEnum, Hex, type HexString, Identity, type OpaqueKeyHash, type SS58AddressInfo, type SS58String, Self, Storage, Twox128, Twox256, Twox64Concat, type V14, type V14Extrinsic, type V14Lookup, type V15, type V15Extrinsic, Variant, _Enum, bitSequence, blockHeader, char, compactBn, compactNumber, decAnyMetadata, ethAccount, fixedStr, fromBufferToBase58, getSs58AddressInfo, h64, metadata, selfDecoder, selfEncoder, v14, lookup as v14Lookup, v15 }; | ||
export { AccountId, Bin, Binary, type BitSequence, Blake2128, Blake2128Concat, Blake2256, Blake3256, Blake3256Concat, type BlockHeader, type EncoderWithHash, Enum, type EnumVariant, type ExtractEnumValue, FixedSizeBinary, type GetEnum, Hex, type HexString, Identity, type OpaqueKeyHash, type SS58AddressInfo, type SS58String, Self, Storage, Twox128, Twox256, Twox64Concat, type V14, type V14Extrinsic, type V14Lookup, type V15, type V15Extrinsic, Variant, _Enum, bitSequence, blockHeader, char, compactBn, compactNumber, decAnyMetadata, ethAccount, fixedStr, fromBufferToBase58, getMultisigAccountId, getSs58AddressInfo, h64, metadata, selfDecoder, selfEncoder, sortMultisigSignatories, v14, lookup as v14Lookup, v15 }; |
@@ -797,2 +797,27 @@ 'use strict'; | ||
const PREFIX = Binary.fromText("modlpy/utilisuba").asBytes(); | ||
const getMultisigAccountId = ({ | ||
threshold, | ||
signatories | ||
}) => { | ||
const sortedSignatories = sortMultisigSignatories(signatories); | ||
const payload = utils.mergeUint8( | ||
PREFIX, | ||
scaleTs.compact.enc(sortedSignatories.length), | ||
...sortedSignatories, | ||
scaleTs.u16.enc(threshold) | ||
); | ||
return Blake2256(payload); | ||
}; | ||
const sortMultisigSignatories = (signatories) => signatories.slice().sort((a, b) => { | ||
for (let i = 0; ; i++) { | ||
const overA = i >= a.length; | ||
const overB = i >= b.length; | ||
if (overA && overB) return 0; | ||
else if (overA) return -1; | ||
else if (overB) return 1; | ||
else if (a[i] !== b[i]) return a[i] > b[i] ? 1 : -1; | ||
} | ||
}); | ||
Object.defineProperty(exports, "Bytes", { | ||
@@ -938,2 +963,3 @@ enumerable: true, | ||
exports.fromBufferToBase58 = fromBufferToBase58; | ||
exports.getMultisigAccountId = getMultisigAccountId; | ||
exports.getSs58AddressInfo = getSs58AddressInfo; | ||
@@ -944,2 +970,3 @@ exports.h64 = h64; | ||
exports.selfEncoder = selfEncoder; | ||
exports.sortMultisigSignatories = sortMultisigSignatories; | ||
exports.v14 = v14; | ||
@@ -946,0 +973,0 @@ exports.v14Lookup = lookup; |
{ | ||
"name": "@polkadot-api/substrate-bindings", | ||
"version": "0.9.4", | ||
"version": "0.10.0", | ||
"author": "Josep M Sobrepere (https://github.com/josepot)", | ||
@@ -5,0 +5,0 @@ "repository": { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
220682
62
3009