w3s-web-core-sdk-test
Version:
Serverless Typescript SDK
1,455 lines (1,418 loc) • 130 kB
TypeScript
import * as viem from 'viem';
import { Hex, Transport, Client, Prettify, Assign, RpcSchema, ClientConfig, CreateClientErrorType, Chain, Account, Hash, Address as Address$1 } from 'viem';
import { CreateCredentialReturnType, PublicKeyCredential as PublicKeyCredential$1, PublicKey, WebAuthnData } from 'webauthn-p256';
import { WebAuthnAccount as WebAuthnAccount$1 } from 'viem/_types/account-abstraction';
import { Address } from 'abitype';
import { WebAuthnAccount, SmartAccount, SmartAccountImplementation } from 'viem/_types/account-abstraction/accounts/types';
import { entryPoint07Abi } from 'viem/account-abstraction/constants/abis';
import { WebAuthnAccount as WebAuthnAccount$2 } from 'viem/account-abstraction';
import { ErrorType } from 'viem/_types/errors/utils';
import { Web3APISpec, EthExecutionAPI, Web3BaseProvider, Web3APIMethod, Web3APIReturnType, Web3APIPayload, Web3ProviderStatus, JsonRpcResponseWithResult } from 'web3-types';
import { Web3APISpec as Web3APISpec$1, Web3APIMethod as Web3APIMethod$1, Web3APIPayload as Web3APIPayload$1, JsonRpcResponseWithResult as JsonRpcResponseWithResult$1 } from 'web3';
/**
* Copyright 2025 Circle Internet Group, Inc. All rights reserved.
*
* SPDX-License-Identifier: Apache-2.0.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at.
*
* Http://www.apache.org/licenses/LICENSE-2.0.
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
* The Webauthn owner.
*/
interface WebauthnOwner {
/**
* The public key X coordinate.
*/
publicKeyX: string;
/**
* The public key Y coordinate.
*/
publicKeyY: string;
/**
* The weight.
*/
weight: number;
}
/**
* The Circle modular wallet weighted multisig.
*/
interface WeightedMultisig {
/**
* The Webauthn owners.
*/
webauthnOwners: WebauthnOwner[];
/**
* The threshold weight.
*/
thresholdWeight: number;
}
/**
* The Circle modular wallet initial ownership configuration.
*/
interface InitialOwnershipConfiguration {
/**
* The ownership contract address.
*/
ownershipContractAddress: Hex;
/**
* The weighted multisig.
*/
weightedMultisig: WeightedMultisig;
}
/**
* The Circle modular wallet SCA configuration.
*/
interface ScaConfiguration {
/**
* The initial ownership configuration.
*/
initialOwnershipConfiguration: InitialOwnershipConfiguration;
/**
* The initial code.
*/
initCode: Hex;
}
/**
* The Circle modular wallet.
*/
interface ModularWallet {
/**
* The wallet ID.
*/
id: string;
/**
* The wallet address.
*/
address: Hex;
/**
* The blockchain.
*/
blockchain: string;
/**
* The state.
*/
state: string;
/**
* The SCA core.
*/
scaCore: string;
/**
* The SCA configuration.
*/
scaConfiguration: ScaConfiguration;
/**
* The create date.
*/
createDate: string;
/**
* The update date.
*/
updateDate: string;
}
/**
* The Get Circle modular wallet address response.
*/
type GetAddressReturnType = ModularWallet;
/**
* Copyright 2025 Circle Internet Group, Inc. All rights reserved.
*
* SPDX-License-Identifier: Apache-2.0.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at.
*
* Http://www.apache.org/licenses/LICENSE-2.0.
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
declare enum WebAuthnMode {
Login = "Login",
Register = "Register"
}
interface CreateCredentialParameters {
credential: PublicKeyCredential;
rpId: string | undefined;
}
interface CustomPublicKeyCredentialDescriptor extends Omit<PublicKeyCredentialDescriptor, 'id'> {
id: string;
}
interface CustomPublicKeyCredentialRequestOptions extends Omit<PublicKeyCredentialRequestOptions, 'allowCredentials' | 'challenge'> {
allowCredentials?: CustomPublicKeyCredentialDescriptor[];
challenge: string;
}
interface CustomPublicKeyCredentialUserEntity extends Omit<PublicKeyCredentialUserEntity, 'id'> {
id: string;
}
interface CustomPublicKeyCredentialCreationOptions extends Omit<PublicKeyCredentialCreationOptions, 'challenge' | 'user'> {
challenge: string;
user: CustomPublicKeyCredentialUserEntity;
}
interface ToWebAuthnAccountParameters {
transport: Transport;
username?: string;
credentialId?: string;
mode: WebAuthnMode;
}
/**
* Available only in secure contexts.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/AuthenticatorAssertionResponse).
*/
interface AuthenticatorAssertionResponse extends AuthenticatorResponse {
/**
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/AuthenticatorAssertionResponse/userHandle).
*/
readonly userHandle: ArrayBuffer;
}
/**
* Available only in secure contexts.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/AuthenticatorAttestationResponse).
*/
interface AuthenticatorAttestationResponse extends AuthenticatorResponse {
/**
* Returns Public Key.
*/
getPublicKey(): ArrayBuffer;
}
interface WebAuthnCredential extends CreateCredentialReturnType {
rpId: string | undefined;
}
type GetLoginOptionsReturnType = CustomPublicKeyCredentialRequestOptions;
type GetRegistrationOptionsReturnType = CustomPublicKeyCredentialCreationOptions;
interface GetLoginVerificationReturnType {
publicKey: string;
}
interface GetRegistrationVerificationReturnType {
verified?: boolean | null;
}
/**
* Copyright 2025 Circle Internet Group, Inc. All rights reserved.
*
* SPDX-License-Identifier: Apache-2.0.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at.
*
* Http://www.apache.org/licenses/LICENSE-2.0.
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
* Generate login options, including a challenge for verification, and return them to the client.
*/
type GetLoginOptionsRpcSchema = {
Method: 'rp_getLoginOptions';
Parameters?: [userId: string];
ReturnType: GetLoginOptionsReturnType;
};
/**
* Verify the login response (authentication credential) and report the outcome to the client.
*/
type GetLoginVerificationRpcSchema = {
Method: 'rp_getLoginVerification';
Parameters?: [authenticationCredential: PublicKeyCredential$1];
ReturnType: GetLoginVerificationReturnType;
};
/**
* Generate and return registration options to the client. The client will use these options to prompt the user to create a passkey.
*/
type GetRegistrationOptionsRpcSchema = {
Method: 'rp_getRegistrationOptions';
Parameters?: [username: string];
ReturnType: GetRegistrationOptionsReturnType;
};
/**
* Verify the registration response (registration credential) and return the results to the client.
*/
type GetRegistrationVerificationRpcSchema = {
Method: 'rp_getRegistrationVerification';
Parameters?: [registrationCredential: PublicKeyCredential$1];
ReturnType: GetRegistrationVerificationReturnType;
};
/**
* Gets the Circle modular wallet address for the user.
*/
type GetAddressRpcSchema = {
Method: 'circle_getAddress';
Parameters?: [
{
scaConfiguration: {
initialOwnershipConfiguration: Omit<InitialOwnershipConfiguration, 'ownershipContractAddress'>;
scaCore: string;
};
}
];
ReturnType: GetAddressReturnType;
};
type RpRpcSchema = [
GetLoginOptionsRpcSchema,
GetLoginVerificationRpcSchema,
GetRegistrationOptionsRpcSchema,
GetRegistrationVerificationRpcSchema
];
type ModularWalletRpcSchema = [GetAddressRpcSchema];
/**
* Copyright 2025 Circle Internet Group, Inc. All rights reserved.
*
* SPDX-License-Identifier: Apache-2.0.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at.
*
* Http://www.apache.org/licenses/LICENSE-2.0.
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
declare const CIRCLE_MSCA_6900_V1_EP07_FACTORY_ABI: readonly [{
readonly type: "constructor";
readonly inputs: readonly [{
readonly name: "_owner";
readonly type: "address";
readonly internalType: "address";
}, {
readonly name: "_entryPointAddr";
readonly type: "address";
readonly internalType: "address";
}, {
readonly name: "_pluginManagerAddr";
readonly type: "address";
readonly internalType: "address";
}];
readonly stateMutability: "nonpayable";
}, {
readonly type: "receive";
readonly stateMutability: "payable";
}, {
readonly type: "function";
readonly name: "acceptOwnership";
readonly inputs: readonly [];
readonly outputs: readonly [];
readonly stateMutability: "nonpayable";
}, {
readonly type: "function";
readonly name: "accountImplementation";
readonly inputs: readonly [];
readonly outputs: readonly [{
readonly name: "";
readonly type: "address";
readonly internalType: "contract UpgradableMSCA";
}];
readonly stateMutability: "view";
}, {
readonly type: "function";
readonly name: "addStake";
readonly inputs: readonly [{
readonly name: "_unstakeDelaySec";
readonly type: "uint32";
readonly internalType: "uint32";
}];
readonly outputs: readonly [];
readonly stateMutability: "payable";
}, {
readonly type: "function";
readonly name: "createAccount";
readonly inputs: readonly [{
readonly name: "_sender";
readonly type: "bytes32";
readonly internalType: "bytes32";
}, {
readonly name: "_salt";
readonly type: "bytes32";
readonly internalType: "bytes32";
}, {
readonly name: "_initializingData";
readonly type: "bytes";
readonly internalType: "bytes";
}];
readonly outputs: readonly [{
readonly name: "account";
readonly type: "address";
readonly internalType: "contract UpgradableMSCA";
}];
readonly stateMutability: "nonpayable";
}, {
readonly type: "function";
readonly name: "entryPoint";
readonly inputs: readonly [];
readonly outputs: readonly [{
readonly name: "";
readonly type: "address";
readonly internalType: "contract IEntryPoint";
}];
readonly stateMutability: "view";
}, {
readonly type: "function";
readonly name: "getAddress";
readonly inputs: readonly [{
readonly name: "_sender";
readonly type: "bytes32";
readonly internalType: "bytes32";
}, {
readonly name: "_salt";
readonly type: "bytes32";
readonly internalType: "bytes32";
}, {
readonly name: "_initializingData";
readonly type: "bytes";
readonly internalType: "bytes";
}];
readonly outputs: readonly [{
readonly name: "addr";
readonly type: "address";
readonly internalType: "address";
}, {
readonly name: "mixedSalt";
readonly type: "bytes32";
readonly internalType: "bytes32";
}];
readonly stateMutability: "view";
}, {
readonly type: "function";
readonly name: "isPluginAllowed";
readonly inputs: readonly [{
readonly name: "";
readonly type: "address";
readonly internalType: "address";
}];
readonly outputs: readonly [{
readonly name: "";
readonly type: "bool";
readonly internalType: "bool";
}];
readonly stateMutability: "view";
}, {
readonly type: "function";
readonly name: "owner";
readonly inputs: readonly [];
readonly outputs: readonly [{
readonly name: "";
readonly type: "address";
readonly internalType: "address";
}];
readonly stateMutability: "view";
}, {
readonly type: "function";
readonly name: "pendingOwner";
readonly inputs: readonly [];
readonly outputs: readonly [{
readonly name: "";
readonly type: "address";
readonly internalType: "address";
}];
readonly stateMutability: "view";
}, {
readonly type: "function";
readonly name: "renounceOwnership";
readonly inputs: readonly [];
readonly outputs: readonly [];
readonly stateMutability: "nonpayable";
}, {
readonly type: "function";
readonly name: "setPlugins";
readonly inputs: readonly [{
readonly name: "_plugins";
readonly type: "address[]";
readonly internalType: "address[]";
}, {
readonly name: "_permissions";
readonly type: "bool[]";
readonly internalType: "bool[]";
}];
readonly outputs: readonly [];
readonly stateMutability: "nonpayable";
}, {
readonly type: "function";
readonly name: "transferOwnership";
readonly inputs: readonly [{
readonly name: "newOwner";
readonly type: "address";
readonly internalType: "address";
}];
readonly outputs: readonly [];
readonly stateMutability: "nonpayable";
}, {
readonly type: "function";
readonly name: "unlockStake";
readonly inputs: readonly [];
readonly outputs: readonly [];
readonly stateMutability: "nonpayable";
}, {
readonly type: "function";
readonly name: "withdrawStake";
readonly inputs: readonly [{
readonly name: "_withdrawAddress";
readonly type: "address";
readonly internalType: "address payable";
}];
readonly outputs: readonly [];
readonly stateMutability: "nonpayable";
}, {
readonly type: "event";
readonly name: "AccountCreated";
readonly inputs: readonly [{
readonly name: "proxy";
readonly type: "address";
readonly indexed: true;
readonly internalType: "address";
}, {
readonly name: "sender";
readonly type: "bytes32";
readonly indexed: false;
readonly internalType: "bytes32";
}, {
readonly name: "salt";
readonly type: "bytes32";
readonly indexed: false;
readonly internalType: "bytes32";
}];
readonly anonymous: false;
}, {
readonly type: "event";
readonly name: "FactoryDeployed";
readonly inputs: readonly [{
readonly name: "factory";
readonly type: "address";
readonly indexed: true;
readonly internalType: "address";
}, {
readonly name: "accountImplementation";
readonly type: "address";
readonly indexed: false;
readonly internalType: "address";
}, {
readonly name: "entryPoint";
readonly type: "address";
readonly indexed: false;
readonly internalType: "address";
}];
readonly anonymous: false;
}, {
readonly type: "event";
readonly name: "OwnershipTransferStarted";
readonly inputs: readonly [{
readonly name: "previousOwner";
readonly type: "address";
readonly indexed: true;
readonly internalType: "address";
}, {
readonly name: "newOwner";
readonly type: "address";
readonly indexed: true;
readonly internalType: "address";
}];
readonly anonymous: false;
}, {
readonly type: "event";
readonly name: "OwnershipTransferred";
readonly inputs: readonly [{
readonly name: "previousOwner";
readonly type: "address";
readonly indexed: true;
readonly internalType: "address";
}, {
readonly name: "newOwner";
readonly type: "address";
readonly indexed: true;
readonly internalType: "address";
}];
readonly anonymous: false;
}, {
readonly type: "error";
readonly name: "Create2FailedDeployment";
readonly inputs: readonly [];
}, {
readonly type: "error";
readonly name: "InvalidInitializationInput";
readonly inputs: readonly [];
}, {
readonly type: "error";
readonly name: "InvalidLength";
readonly inputs: readonly [];
}, {
readonly type: "error";
readonly name: "OwnableInvalidOwner";
readonly inputs: readonly [{
readonly name: "owner";
readonly type: "address";
readonly internalType: "address";
}];
}, {
readonly type: "error";
readonly name: "OwnableUnauthorizedAccount";
readonly inputs: readonly [{
readonly name: "account";
readonly type: "address";
readonly internalType: "address";
}];
}, {
readonly type: "error";
readonly name: "PluginIsNotAllowed";
readonly inputs: readonly [{
readonly name: "plugin";
readonly type: "address";
readonly internalType: "address";
}];
}];
/**
* Copyright 2025 Circle Internet Group, Inc. All rights reserved.
*
* SPDX-License-Identifier: Apache-2.0.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at.
*
* Http://www.apache.org/licenses/LICENSE-2.0.
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
* Parameters to create a Circle smart account.
*/
type ToCircleSmartAccountParameters = {
/**
* The address.
*/
address?: Address;
/**
* The client instance.
*/
client: Client;
/**
* The owner.
*/
owner: WebAuthnAccount;
/**
* The Nonce.
*/
nonce?: bigint;
/**
* The Circle Smart Account Wallet Name.
*/
name?: string;
};
/**
* Return type of the Circle smart account.
*/
type ToCircleSmartAccountReturnType = Prettify<SmartAccount<CircleSmartAccountImplementation>>;
/**
* Circle smart account implementation.
*/
type CircleSmartAccountImplementation = Assign<SmartAccountImplementation<typeof entryPoint07Abi, '0.7', {
abi: typeof entryPoint07Abi;
factory: {
abi: typeof CIRCLE_MSCA_6900_V1_EP07_FACTORY_ABI;
address: Address;
};
}>, {
sign: NonNullable<SmartAccountImplementation['sign']>;
getFactoryArgs: NonNullable<SmartAccountImplementation['getFactoryArgs']>;
}>;
type GetAddressParameters = [
{
/**
* The SCA configuration.
*/
scaConfiguration: {
initialOwnershipConfiguration: Omit<InitialOwnershipConfiguration, 'ownershipContractAddress'>;
scaCore: string;
};
/**
* The metadata.
*/
metadata?: {
name?: string;
};
}
];
/**
* Gets the Circle smart wallet address for the user.
* @param client - Client to use.
* @param params - Parameters to use. See {@link GetAddressParameters}.
* @returns Circle smart wallet creation response. See {@link GetAddressReturnType}.
*/
declare function getAddress(client: Client<Transport>, params: GetAddressParameters): Promise<ModularWallet>;
type GetLoginOptionsParameters = {
userId: string;
};
/**
* Returns the login options, including a challenge for verification.
* @param client - Client to use.
* @param parameters - Parameters to use. See {@link GetLoginOptionsParameters}.
* @returns Credential Request Options. See {@link GetLoginOptionsReturnType}.
*/
declare function getLoginOptions(client: Client<Transport>, { userId }: GetLoginOptionsParameters): Promise<CustomPublicKeyCredentialRequestOptions>;
/**
* Copyright 2025 Circle Internet Group, Inc. All rights reserved.
*
* SPDX-License-Identifier: Apache-2.0.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at.
*
* Http://www.apache.org/licenses/LICENSE-2.0.
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
type GetLoginVerificationParameters = {
credential: PublicKeyCredential$1;
};
/**
* Returns the login verification response to indicate if it's verified or not.
* @param client - Client to use.
* @param parameters - Parameters to use. See {@link GetLoginVerificationParameters}.
* @returns WebAuthn Verification Response. See {@link GetLoginVerificationReturnType}.
*/
declare function getLoginVerification(client: Client<Transport>, { credential }: GetLoginVerificationParameters): Promise<GetLoginVerificationReturnType>;
type GetRegistrationOptionsParameters = {
username: string;
};
/**
* Returns the registration options, including a challenge for verification.
* @param client - Client to use.
* @param parameters - Parameters to use. See {@link GetRegistrationOptionsParameters}.
* @returns Credential Creation Options. See {@link GetRegistrationOptionsReturnType}.
*/
declare function getRegistrationOptions(client: Client<Transport>, { username }: GetRegistrationOptionsParameters): Promise<CustomPublicKeyCredentialCreationOptions>;
/**
* Copyright 2025 Circle Internet Group, Inc. All rights reserved.
*
* SPDX-License-Identifier: Apache-2.0.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at.
*
* Http://www.apache.org/licenses/LICENSE-2.0.
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
type GetRegistrationVerificationParameters = {
credential: PublicKeyCredential$1;
};
/**
* Returns the registration verification response to indicate if it's verified or not.
* @param client - Client to use.
* @param parameters - Parameters to use. See {@link GetRegistrationVerificationParameters}.
* @returns WebAuthn Verification Response. See {@link GetRegistrationVerificationReturnType}.
*/
declare function getRegistrationVerification(client: Client<Transport>, { credential }: GetRegistrationVerificationParameters): Promise<GetRegistrationVerificationReturnType>;
/**
* Copyright 2025 Circle Internet Group, Inc. All rights reserved.
*
* SPDX-License-Identifier: Apache-2.0.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at.
*
* Http://www.apache.org/licenses/LICENSE-2.0.
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
type ModularWalletActions = {
/**
* Gets the modular wallet address for the user.
* @param parameters - Parameters to use. See {@link GetAddressParameters}.
* @returns Wallets created. See {@link GetAddressReturnType}.
*/
getAddress: (parameters: GetAddressParameters) => Promise<GetAddressReturnType>;
};
/**
* Returns the Modular Wallets actions.
* @param client - Client to use.
* @returns Modular Wallets Actions. See {@link ModularWalletActions}.
*/
declare function modularWalletActions<transport extends Transport = Transport>(client: Client<transport>): ModularWalletActions;
/**
* Copyright 2025 Circle Internet Group, Inc. All rights reserved.
*
* SPDX-License-Identifier: Apache-2.0.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at.
*
* Http://www.apache.org/licenses/LICENSE-2.0.
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
type RpActions = {
/**
* Returns the login options, including a challenge for verification.
* @param parameters - Parameters to use. See {@link GetLoginOptionsParameters}.
* @returns Credential Request Options. See {@link GetLoginOptionsReturnType}.
*/
getLoginOptions: (parameters: GetLoginOptionsParameters) => Promise<GetLoginOptionsReturnType>;
/**
* Returns the login verification response to indicate if it's verified or not.
* @param parameters - Parameters to use. See {@link GetLoginVerificationParameters}.
* @returns WebAuthn Verification Response. See {@link GetLoginVerificationReturnType}.
*/
getLoginVerification: (parameters: GetLoginVerificationParameters) => Promise<GetLoginVerificationReturnType>;
/**
* Returns the registration options, including a challenge for verification.
* @param parameters - Parameters to use. See {@link GetRegistrationOptionsParameters}.
* @returns Credential Creation Options. See {@link GetRegistrationOptionsReturnType}.
*/
getRegistrationOptions: (parameters: GetRegistrationOptionsParameters) => Promise<GetRegistrationOptionsReturnType>;
/**
* Returns the registration verification response to indicate if it's verified or not.
* @param parameters - Parameters to use. See {@link GetRegistrationVerificationParameters}.
* @returns WebAuthn Verification Response. See {@link GetRegistrationVerificationReturnType}.
*/
getRegistrationVerification: (parameters: GetRegistrationVerificationParameters) => Promise<GetRegistrationVerificationReturnType>;
};
/**
* Returns the RP actions.
* @param client - Client to use.
* @returns Rp Actions. See.
*/
declare function rpActions<transport extends Transport = Transport>(client: Client<transport>): RpActions;
/**
* Copyright 2025 Circle Internet Group, Inc. All rights reserved.
*
* SPDX-License-Identifier: Apache-2.0.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at.
*
* Http://www.apache.org/licenses/LICENSE-2.0.
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
type RpClientConfig<transport extends Transport = Transport, rpcSchema extends RpcSchema | undefined = undefined> = Prettify<Pick<ClientConfig<transport, undefined, undefined, rpcSchema>, 'cacheTime' | 'key' | 'name' | 'pollingInterval' | 'rpcSchema' | 'transport'>>;
type RpClient<transport extends Transport = Transport, rpcSchema extends RpcSchema | undefined = undefined> = Prettify<Client<transport, undefined, undefined, rpcSchema extends RpcSchema ? [...RpRpcSchema, ...rpcSchema] : RpRpcSchema, RpActions>>;
type CreateRpClientErrorType = CreateClientErrorType | ErrorType;
/**
* Creates a RP Client.
* @param parameters - See {@link RpClientConfig}.
* @returns A RP Client. See {@link RpClient}.
*/
declare function createRpClient<transport extends Transport, rpcSchema extends RpcSchema | undefined = undefined>(parameters: RpClientConfig<transport, rpcSchema>): RpClient<transport, rpcSchema>;
/**
* Copyright 2025 Circle Internet Group, Inc. All rights reserved.
*
* SPDX-License-Identifier: Apache-2.0.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at.
*
* Http://www.apache.org/licenses/LICENSE-2.0.
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
interface ToCircleModularWalletClientParameters {
/**
* The client instance.
*/
client: Client;
}
type ExtendedRpcSchema<rpcSchema extends RpcSchema | undefined = undefined> = rpcSchema extends RpcSchema ? [...ModularWalletRpcSchema, ...rpcSchema] : ModularWalletRpcSchema;
type CircleModularWalletClient = Client<Transport, Chain | undefined, Account | undefined, ExtendedRpcSchema<RpcSchema>, ModularWalletActions>;
/**
* Transforms a client into a Circle modular wallet client using decorators.
* @param parameters - Parameters to use. See {@link ToCircleModularWalletClientParameters}.
* @returns A decorated Circle modular wallet client. See {@link CircleModularWalletClient}.
*/
declare function toCircleModularWalletClient({ client, }: ToCircleModularWalletClientParameters): CircleModularWalletClient;
/**
* Copyright 2025 Circle Internet Group, Inc. All rights reserved.
*
* SPDX-License-Identifier: Apache-2.0.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at.
*
* Http://www.apache.org/licenses/LICENSE-2.0.
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
* Creates a custom transport instance with the given clientUrl and clientKey.
* @param clientUrl - The Client URL to use.
* @param clientKey - The Client key to use.
* @returns The custom transport instance.
*/
declare const toModularTransport: (clientUrl: string, clientKey: string) => viem.CustomTransport;
/**
* Copyright 2025 Circle Internet Group, Inc. All rights reserved.
*
* SPDX-License-Identifier: Apache-2.0.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at.
*
* Http://www.apache.org/licenses/LICENSE-2.0.
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
* Creates a custom transport instance with the given clientUrl and clientKey.
* @param clientUrl - The Client URL to use.
* @param clientKey - The Client key to use.
* @returns The custom transport instance.
*/
declare const toPasskeyTransport: (clientUrl: string, clientKey: string) => viem.CustomTransport;
/**
* Copyright 2025 Circle Internet Group, Inc. All rights reserved.
*
* SPDX-License-Identifier: Apache-2.0.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at.
*
* Http://www.apache.org/licenses/LICENSE-2.0.
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
interface GetCircleSmartAccountAddressParameters {
/**
* The Circle modular wallet client instance.
*/
client: CircleModularWalletClient;
/**
* The owner.
*/
owner: WebAuthnAccount$1;
/**
* The Circle Smart Account Wallet Name.
*/
name?: string;
}
/**
* Gets the Circle modular wallet address.
* @param parameters - Parameters to use. See {@link GetCircleSmartAccountAddressParameters}.
* @returns The Circle modular wallet address.
*/
declare function getModularWalletAddress({ client, owner, name, }: GetCircleSmartAccountAddressParameters): Promise<GetAddressReturnType>;
/**
* Copyright 2025 Circle Internet Group, Inc. All rights reserved.
*
* SPDX-License-Identifier: Apache-2.0.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at.
*
* Http://www.apache.org/licenses/LICENSE-2.0.
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
* Creates a Circle smart account.
* @param parameters - Parameters to use. See {@link ToCircleSmartAccountParameters}.
* @returns Circle smart Account. See {@link ToCircleSmartAccountReturnType}.
*/
declare function toCircleSmartAccount(parameters: ToCircleSmartAccountParameters): Promise<ToCircleSmartAccountReturnType>;
/**
* Copyright 2025 Circle Internet Group, Inc. All rights reserved.
*
* SPDX-License-Identifier: Apache-2.0.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at.
*
* Http://www.apache.org/licenses/LICENSE-2.0.
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
interface WebAuthnSignParameters {
/**
* The hash to sign.
*/
hash: Hash;
/**
* The owner of the account.
*/
owner: WebAuthnAccount$2;
}
/**
* Signs a hash and parses it to a ABI-encoded webauthn signature. The dynamic part of the secp256r1 signature.
* @param parameters - Parameters to use. See {@link WebAuthnSignParameters}.
* @returns The ABI-encoded webauthn signature.
*/
declare const webAuthnSign: ({ hash, owner, }: WebAuthnSignParameters) => Promise<Hex>;
/**
* Copyright 2025 Circle Internet Group, Inc. All rights reserved.
*
* SPDX-License-Identifier: Apache-2.0.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at.
*
* Http://www.apache.org/licenses/LICENSE-2.0.
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
* Returns a WebAuthn credential.
* @param parameters - Parameters to use. See {@link ToWebAuthnAccountParameters}.
* @returns A WebAuthn credential.
*/
declare function toWebAuthnCredential(parameters: ToWebAuthnAccountParameters): Promise<WebAuthnCredential>;
/**
* Starts a WebAuthn registration.
* @param client - RpClient instance.
* @param username - The username to use.
* @returns A WebAuthn Credential.
*/
declare function startRegistration(client: RpClient, username?: string | null): Promise<WebAuthnCredential>;
/**
* Starts a WebAuthn authentication/login.
* @param client - RpClient instance.
* @param credentialId - The credential ID to use.
* @returns A WebAuthn Credential.
*/
declare function startAuthentication(client: RpClient, credentialId?: string | null): Promise<WebAuthnCredential>;
/**
* Transforms to PublicKeyCredentialCreationOptions.
* @param options - CustomPublicKeyCredentialCreationOptions instance.
* @returns PublicKeyCredentialCreationOptions instance.
*/
declare function getCredentialCreationOptions(options: CustomPublicKeyCredentialCreationOptions): PublicKeyCredentialCreationOptions;
/**
* Transforms to PublicKeyCredentialRequestOptions.
* @param options - CustomPublicKeyCredentialRequestOptions instance.
* @returns PublicKeyCredentialRequestOptions instance.
*/
declare function getCredentialRequestOptions(options: CustomPublicKeyCredentialRequestOptions): PublicKeyCredentialRequestOptions;
/**
* Copyright 2025 Circle Internet Group, Inc. All rights reserved.
*
* SPDX-License-Identifier: Apache-2.0.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at.
*
* Http://www.apache.org/licenses/LICENSE-2.0.
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
declare const DEFAULT_RPC_URL = "https://modular-sdk.circle.com/v1/rpc/w3s/buidl";
declare const MODULAR_WALLETS_TRANSPORT_KEY = "Modular wallets transport";
declare const MODULAR_WALLETS_TRANSPORT_NAME = "Modular wallets transport";
/**
* Copyright 2025 Circle Internet Group, Inc. All rights reserved.
*
* SPDX-License-Identifier: Apache-2.0.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at.
*
* Http://www.apache.org/licenses/LICENSE-2.0.
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
declare const ENTRY_POINT_07: {
readonly abi: readonly [{
readonly inputs: readonly [{
readonly name: "success";
readonly type: "bool";
}, {
readonly name: "ret";
readonly type: "bytes";
}];
readonly name: "DelegateAndRevert";
readonly type: "error";
}, {
readonly inputs: readonly [{
readonly name: "opIndex";
readonly type: "uint256";
}, {
readonly name: "reason";
readonly type: "string";
}];
readonly name: "FailedOp";
readonly type: "error";
}, {
readonly inputs: readonly [{
readonly name: "opIndex";
readonly type: "uint256";
}, {
readonly name: "reason";
readonly type: "string";
}, {
readonly name: "inner";
readonly type: "bytes";
}];
readonly name: "FailedOpWithRevert";
readonly type: "error";
}, {
readonly inputs: readonly [{
readonly name: "returnData";
readonly type: "bytes";
}];
readonly name: "PostOpReverted";
readonly type: "error";
}, {
readonly inputs: readonly [];
readonly name: "ReentrancyGuardReentrantCall";
readonly type: "error";
}, {
readonly inputs: readonly [{
readonly name: "sender";
readonly type: "address";
}];
readonly name: "SenderAddressResult";
readonly type: "error";
}, {
readonly inputs: readonly [{
readonly name: "aggregator";
readonly type: "address";
}];
readonly name: "SignatureValidationFailed";
readonly type: "error";
}, {
readonly anonymous: false;
readonly inputs: readonly [{
readonly indexed: true;
readonly name: "userOpHash";
readonly type: "bytes32";
}, {
readonly indexed: true;
readonly name: "sender";
readonly type: "address";
}, {
readonly indexed: false;
readonly name: "factory";
readonly type: "address";
}, {
readonly indexed: false;
readonly name: "paymaster";
readonly type: "address";
}];
readonly name: "AccountDeployed";
readonly type: "event";
}, {
readonly anonymous: false;
readonly inputs: readonly [];
readonly name: "BeforeExecution";
readonly type: "event";
}, {
readonly anonymous: false;
readonly inputs: readonly [{
readonly indexed: true;
readonly name: "account";
readonly type: "address";
}, {
readonly indexed: false;
readonly name: "totalDeposit";
readonly type: "uint256";
}];
readonly name: "Deposited";
readonly type: "event";
}, {
readonly anonymous: false;
readonly inputs: readonly [{
readonly indexed: true;
readonly name: "userOpHash";
readonly type: "bytes32";
}, {
readonly indexed: true;
readonly name: "sender";
readonly type: "address";
}, {
readonly indexed: false;
readonly name: "nonce";
readonly type: "uint256";
}, {
readonly indexed: false;
readonly name: "revertReason";
readonly type: "bytes";
}];
readonly name: "PostOpRevertReason";
readonly type: "event";
}, {
readonly anonymous: false;
readonly inputs: readonly [{
readonly indexed: true;
readonly name: "aggregator";
readonly type: "address";
}];
readonly name: "SignatureAggregatorChanged";
readonly type: "event";
}, {
readonly anonymous: false;
readonly inputs: readonly [{
readonly indexed: true;
readonly name: "account";
readonly type: "address";
}, {
readonly indexed: false;
readonly name: "totalStaked";
readonly type: "uint256";
}, {
readonly indexed: false;
readonly name: "unstakeDelaySec";
readonly type: "uint256";
}];
readonly name: "StakeLocked";
readonly type: "event";
}, {
readonly anonymous: false;
readonly inputs: readonly [{
readonly indexed: true;
readonly name: "account";
readonly type: "address";
}, {
readonly indexed: false;
readonly name: "withdrawTime";
readonly type: "uint256";
}];
readonly name: "StakeUnlocked";
readonly type: "event";
}, {
readonly anonymous: false;
readonly inputs: readonly [{
readonly indexed: true;
readonly name: "account";
readonly type: "address";
}, {
readonly indexed: false;
readonly name: "withdrawAddress";
readonly type: "address";
}, {
readonly indexed: false;
readonly name: "amount";
readonly type: "uint256";
}];
readonly name: "StakeWithdrawn";
readonly type: "event";
}, {
readonly anonymous: false;
readonly inputs: readonly [{
readonly indexed: true;
readonly name: "userOpHash";
readonly type: "bytes32";
}, {
readonly indexed: true;
readonly name: "sender";
readonly type: "address";
}, {
readonly indexed: true;
readonly name: "paymaster";
readonly type: "address";
}, {
readonly indexed: false;
readonly name: "nonce";
readonly type: "uint256";
}, {
readonly indexed: false;
readonly name: "success";
readonly type: "bool";
}, {
readonly indexed: false;
readonly name: "actualGasCost";
readonly type: "uint256";
}, {
readonly indexed: false;
readonly name: "actualGasUsed";
readonly type: "uint256";
}];
readonly name: "UserOperationEvent";
readonly type: "event";
}, {
readonly anonymous: false;
readonly inputs: readonly [{
readonly indexed: true;
readonly name: "userOpHash";
readonly type: "bytes32";
}, {
readonly indexed: true;
readonly name: "sender";
readonly type: "address";
}, {
readonly indexed: false;
readonly name: "nonce";
readonly type: "uint256";
}];
readonly name: "UserOperationPrefundTooLow";
readonly type: "event";
}, {
readonly anonymous: false;
readonly inputs: readonly [{
readonly indexed: true;
readonly name: "userOpHash";
readonly type: "bytes32";
}, {
readonly indexed: true;
readonly name: "sender";
readonly type: "address";
}, {
readonly indexed: false;
readonly name: "nonce";
readonly type: "uint256";
}, {
readonly indexed: false;
readonly name: "revertReason";
readonly type: "bytes";
}];
readonly name: "UserOperationRevertReason";
readonly type: "event";
}, {
readonly anonymous: false;
readonly inputs: readonly [{
readonly indexed: true;
readonly name: "account";
readonly type: "address";
}, {
readonly indexed: false;
readonly name: "withdrawAddress";
readonly type: "address";
}, {
readonly indexed: false;
readonly name: "amount";
readonly type: "uint256";
}];
readonly name: "Withdrawn";
readonly type: "event";
}, {
readonly inputs: readonly [{
readonly name: "unstakeDelaySec";
readonly type: "uint32";
}];
readonly name: "addStake";
readonly outputs: readonly [];
readonly stateMutability: "payable";
readonly type: "function";
}, {
readonly inputs: readonly [{
readonly name: "account";
readonly type: "address";
}];
readonly name: "balanceOf";
readonly outputs: readonly [{
readonly name: "";
readonly type: "uint256";
}];
readonly stateMutability: "view";
readonly type: "function";
}, {
readonly inputs: readonly [{
readonly name: "target";
readonly type: "address";
}, {
readonly name: "data";
readonly type: "bytes";
}];
readonly name: "delegateAndRevert";
readonly outputs: readonly [];
readonly stateMutability: "nonpayable";
readonly type: "function";
}, {
readonly inputs: readonly [{
readonly name: "account";
readonly type: "address";
}];
readonly name: "depositTo";
readonly outputs: readonly [];
readonly stateMutability: "payable";
readonly type: "function";
}, {
readonly inputs: readonly [{
readonly name: "";
readonly type: "address";
}];
readonly name: "deposits";
readonly outputs: readonly [{
readonly name: "deposit";
readonly type: "uint256";
}, {
re