Skip to content

Commit

Permalink
fix: update sdk to use latest contracts version (#34)
Browse files Browse the repository at this point in the history
* fix: update sdk to use latest contracts version

* fix: update package lock file

* fix: restructure sdk client files

* fix: update contracts

* fix: update package lock file

* fix: update addresses

* fix: update addresses, for some reason ci deploys to different addresses

* fix: hmmmm use latest working contracts version

* fix: update contracts version and latest deployment contracts interface

* fix: update contracts addresses

* fix: update sdk to match latest contracts interface

* fix: increase fee limit for nft quest

* chore: bump contracts to use upgradeable factory

* chore: update testnet addresses

---------

Co-authored-by: Lyova Potyomkin <[email protected]>
  • Loading branch information
JackHamer09 and ly0va authored Dec 12, 2024
1 parent 94087ad commit c10812a
Show file tree
Hide file tree
Showing 30 changed files with 707 additions and 439 deletions.
2 changes: 1 addition & 1 deletion examples/nft-quest/stores/connector.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export const useConnectorStore = defineStore("connector", () => {
},
authServerUrl: runtimeConfig.public.authServerUrl,
session: {
feeLimit: parseEther("0.001"),
feeLimit: parseEther("0.002"),
contractCalls: [
callPolicy({
address: runtimeConfig.public.contracts.nft as Hash,
Expand Down
2 changes: 1 addition & 1 deletion packages/auth-server/components/session/tokens.vue
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
</div>
</div>
</div>
<CommonLine v-if="fetchTokensError">
<CommonLine v-if="!tokensLoading && !spendLimitTokens.length && fetchTokensError">
<p class="p-4 text-sm text-error-300 break-all">
Failed to fetch token information. {{ fetchTokensError }}
</p>
Expand Down
16 changes: 8 additions & 8 deletions packages/auth-server/stores/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,16 @@ type ChainContracts = PasskeyRequiredContracts & {
};
export const contractsByChain: Record<SupportedChainId, ChainContracts> = {
[zksyncSepoliaTestnet.id]: {
session: "0x21fe79B31bE4c54c6B4e13303B379Cd4e4fa9489",
passkey: "0x86F20D0701c54019F2f58d0f69767A27BA3E724C",
accountFactory: "0xf9a9fFF7E55F4375FF5f736c58e29B7D4d68aEfb",
accountPaymaster: "0x0cE4c9b3eA74971210C114cc136eAE41148C8B5a",
session: "0x64Bf5C3229CafF50e39Ec58C4BFBbE67bEA90B0F",
passkey: "0x0F65cFE984d494DAa7165863f1Eb61C606e45fFb",
accountFactory: "0x73CFa70318FD25F2166d47Af9d93Cf72eED48724",
accountPaymaster: "0xA46D949858335308859076FA605E773eB679e534",
},
[zksyncInMemoryNode.id]: {
session: "0xd2fEB541bdFfA0401abD5dEE403D3C0d2a3FdCFd",
passkey: "0x960e1934baB4A82d0F1A3C44B0aFa4FADf161868",
accountFactory: "0xd7385ba726A7b72933E63FCb0Dfee8Bcae63478c",
accountPaymaster: "0xbE9F933BE4C1273626E209d1DfF751a41997598D",
session: "0x62b019c03Db1f4d0C0b857fDabE4AbC9c60c2F70",
passkey: "0x21b8397BeF5128662564b8491676baa6754AFD47",
accountFactory: "0x26711A4A572a5BBdF967b6385636Bd968e6E883C",
accountPaymaster: "0xB29C8Dd9a5E5DFeFB49Adf16885175a07DE8e541",
},
};

Expand Down
2 changes: 1 addition & 1 deletion packages/contracts
Submodule contracts updated 44 files
+1 −0 .env.example
+3 −4 .github/workflows/ci.yml
+1 −0 .gitignore
+1 −1 README.md
+30 −28 package.json
+90 −96 pnpm-lock.yaml
+45 −22 scripts/deploy.ts
+8 −14 src/AAFactory.sol
+15 −34 src/SsoAccount.sol
+11 −0 src/SsoBeacon.sol
+1 −9 src/auth/Auth.sol
+0 −20 src/auth/ModuleAuth.sol
+3 −6 src/batch/BatchCaller.sol
+6 −3 src/handlers/ERC1271Handler.sol
+7 −29 src/handlers/ValidationHandler.sol
+0 −203 src/helpers/Base64.sol
+0 −1,058 src/helpers/EIP712.sol
+19 −0 src/helpers/TimestampAsserterLocator.sol
+4 −1 src/interfaces/IHook.sol
+1 −1 src/interfaces/IHookManager.sol
+0 −7 src/interfaces/IModule.sol
+0 −56 src/interfaces/IModuleManager.sol
+12 −2 src/interfaces/IModuleValidator.sol
+0 −54 src/interfaces/IOwnerManager.sol
+1 −9 src/interfaces/ISsoAccount.sol
+6 −0 src/interfaces/ITimestampAsserter.sol
+0 −50 src/interfaces/IValidator.sol
+0 −79 src/interfaces/IValidatorManager.sol
+0 −2 src/libraries/Errors.sol
+42 −21 src/libraries/SessionLib.sol
+2 −2 src/libraries/SignatureDecoder.sol
+0 −17 src/libraries/SsoStorage.sol
+11 −21 src/managers/HookManager.sol
+0 −144 src/managers/ModuleManager.sol
+2 −65 src/managers/OwnerManager.sol
+9 −104 src/managers/ValidatorManager.sol
+9 −2 src/test/ExampleAuthServerPaymaster.sol
+0 −121 src/validators/PasskeyValidator.sol
+46 −64 src/validators/SessionKeyValidator.sol
+76 −12 src/validators/WebAuthValidator.sol
+0 −1 test/BasicTest.ts
+4 −4 test/PasskeyModule.ts
+225 −46 test/SessionKeyTest.ts
+25 −22 test/utils.ts
24 changes: 7 additions & 17 deletions packages/sdk/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -73,24 +73,14 @@
"require": "./dist/_cjs/client/index.js"
},
"./client/passkey": {
"types": "./dist/_types/client/passkey.d.ts",
"import": "./dist/_esm/client/passkey.js",
"require": "./dist/_cjs/client/passkey.js"
"types": "./dist/_types/client/passkey/index.d.ts",
"import": "./dist/_esm/client/passkey/index.js",
"require": "./dist/_cjs/client/passkey/index.js"
},
"./client/smart-account": {
"types": "./dist/_types/client/smart-account.d.ts",
"import": "./dist/_esm/client/smart-account.js",
"require": "./dist/_cjs/client/smart-account.js"
},
"./client/actions": {
"types": "./dist/_types/client/actions/index.d.ts",
"import": "./dist/_esm/client/actions/index.js",
"require": "./dist/_cjs/client/actions/index.js"
},
"./client/decorators": {
"types": "./dist/_types/client/decorators/index.d.ts",
"import": "./dist/_esm/client/decorators/index.js",
"require": "./dist/_cjs/client/decorators/index.js"
"./client/session": {
"types": "./dist/_types/client/session/index.d.ts",
"import": "./dist/_esm/client/session/index.js",
"require": "./dist/_cjs/client/session/index.js"
},
"./communicator": {
"types": "./dist/_types/communicator/index.d.ts",
Expand Down
99 changes: 24 additions & 75 deletions packages/sdk/src/abi/Factory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,32 @@ export const FactoryAbi = [
},
{
internalType: "address",
name: "implementation",
name: "_implementation",
type: "address",
},
],
stateMutability: "nonpayable",
type: "constructor",
},
{
anonymous: false,
inputs: [
{
indexed: true,
internalType: "address",
name: "accountAddress",
type: "address",
},
{
indexed: false,
internalType: "string",
name: "uniqueAccountId",
type: "string",
},
],
name: "AccountCreated",
type: "event",
},
{
anonymous: false,
inputs: [
Expand Down Expand Up @@ -70,92 +89,22 @@ export const FactoryAbi = [
inputs: [
{
internalType: "bytes32",
name: "uniqueAccountId",
type: "bytes32",
},
],
name: "addNewUniqueId",
outputs: [],
stateMutability: "nonpayable",
type: "function",
},
{
inputs: [],
name: "beaconProxyBytecodeHash",
outputs: [
{
internalType: "bytes32",
name: "",
type: "bytes32",
},
],
stateMutability: "view",
type: "function",
},
{
inputs: [
{
internalType: "bytes32",
name: "salt",
name: "_salt",
type: "bytes32",
},
{
internalType: "string",
name: "uniqueAccountId",
name: "_uniqueAccountId",
type: "string",
},
{
internalType: "bytes[]",
name: "initialValidators",
type: "bytes[]",
},
{
internalType: "bytes[]",
name: "initialModules",
type: "bytes[]",
},
{
internalType: "address[]",
name: "initialK1Owners",
type: "address[]",
},
],
name: "deployProxySsoAccount",
outputs: [
{
internalType: "address",
name: "accountAddress",
type: "address",
},
],
stateMutability: "nonpayable",
type: "function",
},
{
inputs: [
{
internalType: "bytes32",
name: "salt",
type: "bytes32",
},
{
internalType: "string",
name: "uniqueAccountId",
type: "string",
},
{
internalType: "bytes[]",
name: "initialValidators",
type: "bytes[]",
},
{
internalType: "bytes[]",
name: "initialModules",
name: "_initialValidators",
type: "bytes[]",
},
{
internalType: "address[]",
name: "initialK1Owners",
name: "_initialK1Owners",
type: "address[]",
},
],
Expand Down
133 changes: 0 additions & 133 deletions packages/sdk/src/abi/SessionKeyModule.ts
Original file line number Diff line number Diff line change
@@ -1,26 +1,4 @@
export const SessionKeyModuleAbi = [
{
inputs: [
{
internalType: "address",
name: "smartAccount",
type: "address",
},
],
name: "AlreadyInitialized",
type: "error",
},
{
inputs: [
{
internalType: "address",
name: "smartAccount",
type: "address",
},
],
name: "NotInitialized",
type: "error",
},
{
anonymous: false,
inputs: [
Expand Down Expand Up @@ -508,49 +486,6 @@ export const SessionKeyModuleAbi = [
stateMutability: "view",
type: "function",
},
{
inputs: [
{
internalType: "uint256",
name: "typeID",
type: "uint256",
},
],
name: "isModuleType",
outputs: [
{
internalType: "bool",
name: "",
type: "bool",
},
],
stateMutability: "pure",
type: "function",
},
{
inputs: [
{
internalType: "bytes32",
name: "hash",
type: "bytes32",
},
{
internalType: "bytes",
name: "signature",
type: "bytes",
},
],
name: "isValidSignature",
outputs: [
{
internalType: "bytes4",
name: "magic",
type: "bytes4",
},
],
stateMutability: "view",
type: "function",
},
{
inputs: [],
name: "name",
Expand All @@ -564,74 +499,6 @@ export const SessionKeyModuleAbi = [
stateMutability: "pure",
type: "function",
},
{
inputs: [
{
internalType: "bytes",
name: "data",
type: "bytes",
},
],
name: "onInstall",
outputs: [],
stateMutability: "nonpayable",
type: "function",
},
{
inputs: [
{
internalType: "bytes",
name: "",
type: "bytes",
},
],
name: "onUninstall",
outputs: [],
stateMutability: "nonpayable",
type: "function",
},
{
inputs: [
{
internalType: "bytes",
name: "hookData",
type: "bytes",
},
],
name: "postCheck",
outputs: [],
stateMutability: "nonpayable",
type: "function",
},
{
inputs: [
{
internalType: "address",
name: "msgSender",
type: "address",
},
{
internalType: "uint256",
name: "msgValue",
type: "uint256",
},
{
internalType: "bytes",
name: "msgData",
type: "bytes",
},
],
name: "preCheck",
outputs: [
{
internalType: "bytes",
name: "hookData",
type: "bytes",
},
],
stateMutability: "nonpayable",
type: "function",
},
{
inputs: [
{
Expand Down
6 changes: 3 additions & 3 deletions packages/sdk/src/client-auth-server/Signer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,18 @@ import { type Address, type Chain, createWalletClient, custom, type Hash, http,

import { createZksyncSessionClient, type ZksyncSsoSessionClient } from "../client/index.js";
import type { Communicator } from "../communicator/index.js";
import { type SessionConfig } from "../utils/session.js";
import { StorageItem } from "../utils/storage.js";
import type { AppMetadata, RequestArguments } from "./interface.js";
import type { AuthServerRpcSchema, ExtractParams, ExtractReturnType, Method, RPCRequestMessage, RPCResponseMessage, RpcSchema } from "./rpc.js";
import type { SessionPreferences } from "./session/index.js";
import { parseSessionConfigJSON, type SessionConfigJSON } from "./session/utils.js";

type Account = {
address: Address;
activeChainId: Chain["id"];
session?: {
sessionKey: Hash;
sessionConfig: SessionConfig;
sessionConfig: SessionConfigJSON;
};
};

Expand Down Expand Up @@ -132,7 +132,7 @@ export class Signer implements SignerInterface {
instance: createZksyncSessionClient({
address: this.account.address,
sessionKey: session.sessionKey,
sessionConfig: session.sessionConfig,
sessionConfig: parseSessionConfigJSON(session.sessionConfig),
contracts: chainInfo.contracts,
chain,
transport: this.transports[chain.id] || http(),
Expand Down
Loading

0 comments on commit c10812a

Please sign in to comment.