Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
},
"dependencies": {
"@changesets/cli": "^2.28.1",
"@nucypher/nucypher-core": "^0.15.1-dev.2",
"@nucypher/nucypher-core": "^0.15.1-dev.3",
"ethers": "^5.8.0"
},
"devDependencies": {
Expand Down Expand Up @@ -65,7 +65,7 @@
]
},
"overrides": {
"@nucypher/nucypher-core": "^0.15.1-dev.2",
"@nucypher/nucypher-core": "^0.15.1-dev.3",
"glob-parent@<5.1.2": ">=5.1.2",
"node-forge@<1.0.0": ">=1.0.0",
"node-forge@<1.3.0": ">=1.3.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/pre/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
"typedoc": "typedoc"
},
"dependencies": {
"@nucypher/nucypher-core": "^0.15.1-dev.2",
"@nucypher/nucypher-core": "^0.15.1-dev.3",
"@nucypher/shared": "workspace:*",
"ethers": "^5.8.0"
},
Expand Down
2 changes: 1 addition & 1 deletion packages/shared/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
"@ethersproject/abi": "^5.8.0",
"@ethersproject/providers": "^5.8.0",
"@nucypher/nucypher-contracts": "^0.26.0-alpha.2",
"@nucypher/nucypher-core": "^0.15.1-dev.2",
"@nucypher/nucypher-core": "^0.15.1-dev.3",
"axios": "^1.8.4",
"deep-equal": "^2.2.3",
"ethers": "^5.8.0",
Expand Down
8 changes: 6 additions & 2 deletions packages/shared/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,10 @@ function getBigIntValue(value: bigint | number): bigint {
return typeof value === 'bigint' ? value : BigInt(value);
}

function getUint256String(value: bigint | number): string {
return getBigIntValue(value).toString();
}

function getUint8ArrayValue(value: `0x${string}` | Uint8Array): Uint8Array {
return value instanceof Uint8Array ? value : fromHexString(value);
}
Expand All @@ -50,7 +54,7 @@ export function toCoreUserOperation(
): UserOperation {
const userOp = new UserOperation(
userOperation.sender,
getBigIntValue(userOperation.nonce),
getUint256String(userOperation.nonce), // nonce as string to support big numbers
getUint8ArrayValue(userOperation.callData),
getBigIntValue(userOperation.callGasLimit),
getBigIntValue(userOperation.verificationGasLimit),
Expand Down Expand Up @@ -99,7 +103,7 @@ export function toCorePackedUserOperation(
): PackedUserOperation {
const packedUserOp = new PackedUserOperation(
packedUserOperation.sender,
getBigIntValue(packedUserOperation.nonce),
getUint256String(packedUserOperation.nonce), // nonce as string to support big numbers
getUint8ArrayValue(packedUserOperation.initCode),
getUint8ArrayValue(packedUserOperation.callData),
getUint8ArrayValue(packedUserOperation.accountGasLimits),
Expand Down
44 changes: 22 additions & 22 deletions packages/shared/test/porter.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,9 @@ import axios, { HttpStatusCode } from 'axios';
import { beforeAll, describe, expect, it, MockInstance, vi } from 'vitest';

import {
PackedUserOperation,
PackedUserOperationSignatureRequest,
SessionStaticSecret,
SignatureResponse,
UserOperation,
UserOperationSignatureRequest,
} from '@nucypher/nucypher-core';

Expand All @@ -19,6 +17,8 @@ import {
initialize,
PorterClient,
toBase64,
toCorePackedUserOperation,
toCoreUserOperation,
toHexString,
Ursula,
} from '../src';
Expand Down Expand Up @@ -238,16 +238,16 @@ describe('PorterClient Signing', () => {

const createUserOpSignatureRequest = () =>
new UserOperationSignatureRequest(
new UserOperation(
'0x000000000000000000000000000000000000000a',
BigInt(123), // nonce
fromHexString('0xabc'), // callData
BigInt(456), // callGasLimit
BigInt(789), // verificationGasLimit
BigInt(101112), // preVerificationGasLimit
BigInt(131415), // maxFeePerGas
BigInt(161718), // maxPriorityFeePerGas
),
toCoreUserOperation({
sender: '0x000000000000000000000000000000000000000a',
nonce: BigInt(123),
callData: fromHexString('0xabc'),
callGasLimit: BigInt(456),
verificationGasLimit: BigInt(789),
preVerificationGas: BigInt(101112),
maxFeePerGas: BigInt(131415),
maxPriorityFeePerGas: BigInt(161718),
}),
1, // cohort ID
BigInt(1), // chain ID
'0.8.0',
Expand Down Expand Up @@ -284,16 +284,16 @@ describe('PorterClient Signing', () => {
it('should successfully sign a PackedUserOperation', async () => {
const packedUserOperationSignatureRequest =
new PackedUserOperationSignatureRequest(
new PackedUserOperation(
'0x000000000000000000000000000000000000000a',
BigInt(123), // nonce
fromHexString('0xabc'), // initCode
fromHexString('0xdef'), // callData
fromHexString('0x01020304'), // accountGasLimits
BigInt(101112), // preVerificationGas
fromHexString('0x05060708'), // gasFees
fromHexString('0x090a0b0c'), // paymasterAndData
),
toCorePackedUserOperation({
sender: '0x000000000000000000000000000000000000000a',
nonce: BigInt(123),
initCode: fromHexString('0xabc'),
callData: fromHexString('0xdef'),
accountGasLimits: fromHexString('0x01020304'),
preVerificationGas: BigInt(101112),
gasFees: fromHexString('0x05060708'),
paymasterAndData: fromHexString('0x090a0b0c'),
}),
1, // cohort ID
BigInt(1), // chain ID
'mdt',
Expand Down
2 changes: 1 addition & 1 deletion packages/taco/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
},
"dependencies": {
"@astronautlabs/jsonpath": "^1.1.2",
"@nucypher/nucypher-core": "^0.15.1-dev.2",
"@nucypher/nucypher-core": "^0.15.1-dev.3",
"@nucypher/shared": "workspace:*",
"@nucypher/taco-auth": "workspace:*",
"ethers": "^5.8.0",
Expand Down
5 changes: 3 additions & 2 deletions packages/taco/test/taco-sign.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@ function checkPackedUserOpEquality(
op2: PackedUserOperation,
) {
expect(op1.sender).toEqual(op2.sender);
expect(toBigInt(op1.nonce)).toEqual(op2.nonce);

expect(toBigInt(op1.nonce).toString()).toEqual(`${op2.nonce}`); // nonce as string internally to support big numbers

const initCode =
op1.initCode instanceof Uint8Array
Expand Down Expand Up @@ -77,7 +78,7 @@ function checkPackedUserOpEquality(
function checkUserOpEquality(op1: UserOperationToSign, op2: UserOperation) {
expect(op1.sender).toEqual(op2.sender);

expect(toBigInt(op1.nonce)).toEqual(op2.nonce);
expect(toBigInt(op1.nonce).toString()).toEqual(`${op2.nonce}`); // nonce as string internally to support big numbers

const callData =
op1.callData instanceof Uint8Array
Expand Down
2 changes: 1 addition & 1 deletion packages/test-utils/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
"lint:fix": "pnpm lint --fix"
},
"dependencies": {
"@nucypher/nucypher-core": "^0.15.1-dev.2",
"@nucypher/nucypher-core": "^0.15.1-dev.3",
"@nucypher/shared": "workspace:*",
"@nucypher/taco-auth": "workspace:*",
"axios": "^1.8.4",
Expand Down
32 changes: 16 additions & 16 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.