Skip to content

Commit

Permalink
fix: update sdk to use latest contracts version
Browse files Browse the repository at this point in the history
  • Loading branch information
JackHamer09 committed Dec 8, 2024
1 parent 94087ad commit 87b30df
Show file tree
Hide file tree
Showing 15 changed files with 271 additions and 236 deletions.
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
6 changes: 3 additions & 3 deletions packages/auth-server/stores/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,10 @@ export const contractsByChain: Record<SupportedChainId, ChainContracts> = {
accountPaymaster: "0x0cE4c9b3eA74971210C114cc136eAE41148C8B5a",
},
[zksyncInMemoryNode.id]: {
session: "0xd2fEB541bdFfA0401abD5dEE403D3C0d2a3FdCFd",
passkey: "0x960e1934baB4A82d0F1A3C44B0aFa4FADf161868",
session: "0x62EdCb3fABe6b39bDf04FEE3Cf4F9ebaA6DD9E23",
passkey: "0x90C449B74621a112d3cf9F912431125475c9E846",
accountFactory: "0xd7385ba726A7b72933E63FCb0Dfee8Bcae63478c",
accountPaymaster: "0xbE9F933BE4C1273626E209d1DfF751a41997598D",
accountPaymaster: "0x07412DA1BfB1fC58a69739A004924d6e122bc2D4",
},
};

Expand Down
96 changes: 25 additions & 71 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,27 @@ 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",
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",
name: "_uniqueAccountId",
type: "string",
},
{
internalType: "bytes[]",
name: "initialValidators",
name: "_initialValidators",
type: "bytes[]",
},
{
internalType: "bytes[]",
name: "initialModules",
name: "_initialModules",
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
4 changes: 2 additions & 2 deletions packages/sdk/src/client-auth-server/rpc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ import type { Address, Chain, Hash, PublicRpcSchema, RpcSchema as RpcSchemaGener
import type { SessionRequiredContracts } from "../client/index.js";
import type { Message } from "../communicator/index.js";
import type { SerializedEthereumRpcError } from "../errors/index.js";
import type { SessionConfig } from "../utils/session.js";
import type { AppMetadata, RequestArguments } from "./interface.js";
import type { SessionPreferences } from "./session/index.js";
import type { SessionConfigJSON } from "./session/utils.js";

export type AuthServerRpcSchema = [
{
Expand All @@ -20,7 +20,7 @@ export type AuthServerRpcSchema = [
activeChainId: Chain["id"];
session?: {
sessionKey: Hash;
sessionConfig: SessionConfig;
sessionConfig: SessionConfigJSON;
};
};
chainsInfo: {
Expand Down
8 changes: 8 additions & 0 deletions packages/sdk/src/client-auth-server/session/type-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,11 @@ export type IndexedValues<T extends unknown[]> = Array<{
}[NumericKeys<T>]>;

export type ContractWriteMutability = Extract<AbiStateMutability, "nonpayable" | "payable">;

export type ConvertBigIntToString<T> = T extends bigint
? string
: T extends Array<infer U>
? Array<ConvertBigIntToString<U>>
: T extends object
? { [K in keyof T]: ConvertBigIntToString<T[K]> }
: T;
Loading

0 comments on commit 87b30df

Please sign in to comment.