diff --git a/src/index.ts b/src/index.ts index 39a2150..bf7a083 100644 --- a/src/index.ts +++ b/src/index.ts @@ -252,7 +252,7 @@ const renderCurrentMultisigInfo = (): void => { if (lastOrder.type === 'pending' && myAddress) { const myIndex = lastOrder.orderInfo.signers.findIndex(signer => signer.address.equals(myAddress)); if (myIndex > -1) { - const mask = 1 << myIndex; + const mask = 1n << BigInt(myIndex); const isSigned = lastOrder.orderInfo.approvalsMask & mask; text += isSigned ? ' — You approved' : ` — You haven't approved yet`; @@ -404,7 +404,7 @@ const renderCurrentOrderInfo = (): void => { for (let i = 0; i < signers.length; i++) { const signer = signers[i]; const addressString = makeAddressLink(signer); - const mask = 1 << i; + const mask = 1n << BigInt(i); const isSigned = approvalsMask & mask; if (myAddress && isSigned && signer.address.equals(myAddress)) { isApprovedByMe = true; diff --git a/src/multisig/MultisigOrderChecker.ts b/src/multisig/MultisigOrderChecker.ts index 0c6131f..c0ba9e1 100644 --- a/src/multisig/MultisigOrderChecker.ts +++ b/src/multisig/MultisigOrderChecker.ts @@ -20,7 +20,7 @@ export interface MultisigOrderInfo { orderId: bigint; isExecuted: boolean; approvalsNum: number; - approvalsMask: number; + approvalsMask: bigint; threshold: number; signers: AddressInfo[]; expiresAt: Date; @@ -28,10 +28,13 @@ export interface MultisigOrderInfo { stateInitMatches: boolean; } -const checkNumber = (n: number) => { +const checkNumber = (n: number | bigint) => { if (n === null) throw new Error('Invalid number'); if (n === undefined) throw new Error('Invalid number'); - if (isNaN(n)) throw new Error('Invalid number'); + + if (typeof n !== 'bigint') { + if (isNaN(n)) throw new Error('Invalid number'); + } if (n < 0) throw new Error('Invalid number'); } diff --git a/src/multisig/Order.ts b/src/multisig/Order.ts index 443a8a0..1919c8d 100644 --- a/src/multisig/Order.ts +++ b/src/multisig/Order.ts @@ -47,7 +47,7 @@ export function parseOrderData(data: Cell) { const threshold = slice.loadUint(8); const isExecuted = slice.loadBoolean(); const signers = cellToArray(slice.loadRef()); - const approvalsMask = slice.loadUint(1 << 8); + const approvalsMask = slice.loadUintBig(1 << 8); const approvalsNum = slice.loadUint(8); const expirationDate = slice.loadUint(48); const order = slice.loadRef();