### Solidity Interface and Example Usage of ISafe Setup Source: https://github.com/safe-global/safe-docs/blob/main/pages/reference-smart-account/setup/setup.mdx Demonstrates the `ISafe` interface and provides an example of calling the `setup` function within a contract. This snippet shows the full signature and a sample invocation. ```solidity interface ISafe { function setup( address[] _owners, uint256 _threshold, address to, bytes data, address fallbackHandler, address paymentToken, uint256 payment, address payable paymentReceiver ) external; } contract Example { function example() ... { (ISafe safe).setup( [0x..., 0x...], 1, 0x..., "0x...", 0x..., 0x..., 0, 0x... ); } } ``` -------------------------------- ### Install Dependencies Source: https://github.com/safe-global/safe-docs/blob/main/pages/advanced/erc-4337/guides/permissionless-quickstart.mdx Install the viem and permissionless libraries for building with ERC-4337. ```bash pnpm install viem permissionless ``` -------------------------------- ### Install Protocol Kit Source: https://github.com/safe-global/safe-docs/blob/main/pages/reference-sdk-protocol-kit/overview.mdx Install the Protocol Kit using yarn. ```bash yarn add @safe-global/protocol-kit ``` -------------------------------- ### Install Dependencies Source: https://github.com/safe-global/safe-docs/blob/main/pages/sdk/api-kit/guides/propose-and-confirm-transactions.mdx Install the necessary Safe SDK packages for your project. ```bash yarn add @safe-global/api-kit \ @safe-global/protocol-kit \ @safe-global/types-kit ``` -------------------------------- ### Install Magic SDK Source: https://github.com/safe-global/safe-docs/blob/main/pages/sdk/signers/magic.mdx Install the Magic SDK using npm, yarn, or pnpm. ```bash npm install magic-sdk ``` ```bash yarn add magic-sdk ``` ```bash pnpm add magic-sdk ``` -------------------------------- ### Install Protocol Kit Source: https://github.com/safe-global/safe-docs/blob/main/pages/sdk/protocol-kit/guides/signatures/messages.mdx Install the necessary package for using the Protocol Kit. ```bash yarn install @safe-global/protocol-kit ``` -------------------------------- ### Install Dependencies Source: https://github.com/safe-global/safe-docs/blob/main/pages/sdk/signers/web3auth.mdx Install the necessary Web3Auth packages for npm, yarn, or pnpm. ```bash npm install @web3auth/modal @web3auth/base @web3auth/ethereum-provider ``` ```bash yarn add @web3auth/modal @web3auth/base @web3auth/ethereum-provider ``` ```bash pnpm add @web3auth/modal @web3auth/base @web3auth/ethereum-provider ``` -------------------------------- ### AI Agent Setup with Safe Smart Account Source: https://github.com/safe-global/safe-docs/blob/main/public/llms-ctx.txt Set up an AI agent using LangChain and Ollama to interact with Safe Smart Accounts. This example demonstrates adding Safe-specific tools for account management and transaction preparation. ```typescript import { defineConfig, ChatOllama, OllamaInput, } from '@langchain/community/chat_models/ollama' import { SafeTool } from './tools/safe'; import { PricesTool } from './tools/prices'; import { MathTool } from './tools/math'; // Set up the AI model const model = new ChatOllama({ baseUrl: 'http://localhost:11434', model: 'mistral-nemo', temperature: 0 }); // Add Safe-specific tools const tools = [ new MathTool(), new PricesTool(), new SafeTool() ]; // Create agent with tools and model const agent = createReactAgent({ llm: model, tools: tools }); // Example prompt to deploy a new Safe account const response = await agent.invoke({ input: ` Deploy a new Safe account with the following configuration: - Network: Sepolia - Owners: 0x742d35Cc6634C0532925a3b844Bc454e4438f44e, ${process.env.SIGNER_ADDRESS} - Threshold: 2 - Use 0.01 ETH to fund it ` }); console.log(response.output); ``` -------------------------------- ### Install Dependencies Source: https://github.com/safe-global/safe-docs/blob/main/README.md Install project dependencies using pnpm. ```bash pnpm install ``` -------------------------------- ### Install Dependencies (Python) Source: https://github.com/safe-global/safe-docs/blob/main/pages/core-api/transaction-service-guides/data-decoder.mdx Install the safe-eth-py and web3 libraries for Python projects. ```bash pip install safe-eth-py web3 ``` -------------------------------- ### Get Delegates with Offset Source: https://github.com/safe-global/safe-docs/blob/main/pages/reference-sdk-api-kit/getsafedelegates.mdx Retrieve delegates starting from a specific index. This example demonstrates using the `offset` parameter for pagination. ```typescript const delegates = await apiKit.getSafeDelegates({ offset: '50' }) ``` -------------------------------- ### Get User Operation Request Example Source: https://github.com/safe-global/safe-docs/blob/main/components/ApiReference/generated/base-sepolia-reference.mdx Example of how to make a GET request to retrieve a user operation by its hash. Ensure you include your API key for authorization. ```bash curl -X GET https://api.safe.global/tx-service/basesep/api/v1/user-operations/0xe6dac94a3cdbab8d807dfbe79ec378713403ff60cb1a1fff09696813d2705b8e/ \ -H "Accept: application/json" \ -H "content-type: application/json" \ -H "Authorization: Bearer YOUR_API_KEY" \ ``` -------------------------------- ### Initialize Project Directory and npm Source: https://github.com/safe-global/safe-docs/blob/main/pages/advanced/smart-account-fallback-handler/smart-account-fallback-handler-tutorial.mdx Sets up a new project directory and initializes npm for the project. ```bash mkdir safe-fallback-handler-tutorial && cd safe-fallback-handler-tutorial npm init -y ``` -------------------------------- ### Install Starter Kit with npm Source: https://github.com/safe-global/safe-docs/blob/main/pages/reference-sdk-starter-kit/overview.mdx Install the Safe Starter Kit package using npm. ```bash npm install @safe-global/sdk-starter-kit ``` -------------------------------- ### Install and Start AASA Server Source: https://github.com/safe-global/safe-docs/blob/main/pages/advanced/passkeys/tutorials/react-native.mdx Install dependencies and start the Node.js Express server for AASA (Apple App Site Association). This server is used for testing passkey configurations. ```bash cd aasa-server npm install npm start ``` -------------------------------- ### Install Starter Kit with pnpm Source: https://github.com/safe-global/safe-docs/blob/main/pages/reference-sdk-starter-kit/overview.mdx Install the Safe Starter Kit package using pnpm. ```bash pnpm add @safe-global/sdk-starter-kit ``` -------------------------------- ### Install Starter Kit with yarn Source: https://github.com/safe-global/safe-docs/blob/main/pages/reference-sdk-starter-kit/overview.mdx Install the Safe Starter Kit package using yarn. ```bash yarn add @safe-global/sdk-starter-kit ``` -------------------------------- ### Get Transaction with Specific Hash Source: https://github.com/safe-global/safe-docs/blob/main/pages/reference-sdk-api-kit/gettransaction.mdx This example demonstrates calling `getTransaction` with a placeholder transaction hash. ```typescript const tx = await apiKit.getTransaction( '0x...' ) ``` -------------------------------- ### Sample Response for Get Message Source: https://github.com/safe-global/safe-docs/blob/main/components/ApiReference/generated/base-reference.mdx Example JSON response when successfully retrieving message details. ```json { "created": "2024-07-29T16:59:00.807652Z", "modified": "2024-07-29T16:59:00.807652Z", "safe": "0x5298A93734C3D979eF1f23F78eBB871879A21F22", "messageHash": "0x950cfe6090e742b709ab5f662c10c8b4e06d403a2f8c4654d86af45d93fa3777", "message": "string message", "proposedBy": "0xa6d3DEBAAB2B8093e69109f23A75501F864F74e2", "safeAppId": null, "confirmations": [ { "created": "2024-07-29T16:59:00.843249Z", "modified": "2024-07-29T16:59:00.843249Z", "owner": "0xa6d3DEBAAB2B8093e69109f23A75501F864F74e2", "signature": "0x5f12f647a876c1966cfbb785d78add0e504cdd0b56b9e21ac93a566d883f80af0192226678ffbe04b35efd23265f1b516a0b0920c679b13d9a5290af0c4b87931f", "signatureType": "ETH_SIGN" } ], "preparedSignature": "0x5f12f647a876c1966cfbb785d78add0e504cdd0b56b9e21ac93a566d883f80af0192226678ffbe04b35efd23265f1b516a0b0920c679b13d9a5290af0c4b87931f" } ``` -------------------------------- ### Install Dependencies for Safe Migration Tutorial Source: https://github.com/safe-global/safe-docs/blob/main/pages/advanced/smart-account-migration.mdx Install the necessary packages for the Safe migration tutorial, including Protocol Kit, types kit, and viem. Also, add TypeScript support. ```bash mkdir safe-migration-tutorial && cd safe-migration-tutorial npm init -y npm install @safe-global/protocol-kit @safe-global/types-kit viem npm install --save-dev typescript ts-node npx tsc --init ``` -------------------------------- ### Get Transaction Confirmations with Specific Hash Source: https://github.com/safe-global/safe-docs/blob/main/pages/reference-sdk-api-kit/gettransactionconfirmations.mdx Example demonstrating how to call `getTransactionConfirmations` with a specific transaction hash. ```typescript const confirmations = await apiKit.getTransactionConfirmations( '0x...' ) ``` -------------------------------- ### Set Up Environment Variables Source: https://github.com/safe-global/safe-docs/blob/main/pages/advanced/passkeys/tutorials/react-native.mdx Configure your project's environment variables by creating a .env file. Replace placeholders with your private key and owner addresses. ```bash // from ../../../../examples/react-native-passkeys/.env-sample ``` -------------------------------- ### Initialize SDK Starter Kit for On-Chain Messages Source: https://github.com/safe-global/safe-docs/blob/main/pages/reference-sdk-starter-kit/onchain-messages/sendonchainmessage.mdx This snippet shows how to set up the SDK starter kit, including the `createSafeClient` and extending it with `onChainMessages`. This setup is required before using `sendOnChainMessage`. ```typescript import { createSafeClient, onChainMessages } from '@safe-global/sdk-starter-kit' const safeClient = await createSafeClient({ provider, signer, safeAddress: '0x...' }) export const onchainMessageClient = safeClient.extend(onChainMessages()) ``` -------------------------------- ### Get Delegates by Label Source: https://github.com/safe-global/safe-docs/blob/main/pages/reference-sdk-api-kit/getsafedelegates.mdx Retrieve delegates that match a custom label. This example demonstrates using the `label` parameter. ```typescript const delegates = await apiKit.getSafeDelegates({ label: 'abc' }) ``` -------------------------------- ### Create Environment File Source: https://github.com/safe-global/safe-docs/blob/main/README.md Copy the example environment file to create a new .env file for local configuration. ```bash cp .env.example .env ``` -------------------------------- ### Get Token Information with Specific Address Source: https://github.com/safe-global/safe-docs/blob/main/pages/reference-sdk-api-kit/gettoken.mdx This example demonstrates calling `getToken` with a placeholder token address. The `apiKit` instance should be pre-configured. ```typescript const token = await apiKit.getToken( '0x...' ) ``` -------------------------------- ### Get Safe Information with Specific Address Source: https://github.com/safe-global/safe-docs/blob/main/pages/reference-sdk-api-kit/getsafeinfo.mdx This example demonstrates calling `getSafeInfo` with a specific Safe address. It highlights the `safeAddress` parameter. ```typescript const safeInfo = await apiKit.getSafeInfo( '0x...' ) ``` -------------------------------- ### Get Messages with Offset Source: https://github.com/safe-global/safe-docs/blob/main/pages/reference-sdk-api-kit/getmessages.mdx Fetches messages for a Safe account starting from a specific index. Use the 'offset' parameter to paginate through results. ```typescript const messagesResponse = await apiKit.getMessages( '0x...', { offset: 50 } ) ``` -------------------------------- ### Setup Off-Chain Message Client Source: https://github.com/safe-global/safe-docs/blob/main/pages/reference-sdk-starter-kit/offchain-messages/getpendingoffchainmessages.mdx Initialize the SDK Starter Kit client and extend it with the `offChainMessages` module to enable off-chain message functionalities. This setup is required before calling methods like `getPendingOffChainMessages`. ```typescript import { createSafeClient, offChainMessages } from '@safe-global/sdk-starter-kit' const safeClient = await createSafeClient({ provider, signer, safeAddress: '0x...' }) export const offchainMessageClient = safeClient.extend(offChainMessages()) ``` -------------------------------- ### Get Owners Who Approved a Transaction (Specific Hash) Source: https://github.com/safe-global/safe-docs/blob/main/pages/reference-sdk-starter-kit/safe-client/getownerswhoapprovedtransaction.mdx This example shows how to call `getOwnersWhoApprovedTransaction` with a specific transaction hash. It highlights the `safeTxHash` parameter. ```typescript const owners = safeClient.getOwnersWhoApprovedTransaction( '0x...' ) ``` -------------------------------- ### Protocol Kit Setup Source: https://github.com/safe-global/safe-docs/blob/main/pages/reference-sdk-protocol-kit/deployment/getsafeaddressfromdeploymenttx.mdx This snippet shows the basic setup for Protocol Kit, which is required for interacting with Safe accounts. It initializes the SDK with provider, signer, and Safe address. ```typescript import Safe from '@safe-global/protocol-kit' export const protocolKit = Safe.init({ provider, signer, safeAddress: '0x...' }) ``` -------------------------------- ### Run Development Server Source: https://github.com/safe-global/safe-docs/blob/main/README.md Start the project server in development mode. ```bash pnpm dev ``` -------------------------------- ### Get Safes by Module Address with Specific Address Source: https://github.com/safe-global/safe-docs/blob/main/pages/reference-sdk-api-kit/getsafesbymodule.mdx This example demonstrates calling `getSafesByModule` with a specific module address, highlighting the parameter usage. ```typescript const safes = await getSafesByModule( '0x...' ) ``` -------------------------------- ### Setup Safe Client and Options Source: https://github.com/safe-global/safe-docs/blob/main/pages/reference-sdk-starter-kit/safe-operations/confirmsafeoperation.mdx This snippet demonstrates how to set up the Safe client with provider, signer, and Safe address. It also shows how to configure bundler and paymaster options for sponsored transactions. ```typescript import { createSafeClient, safeOperations } from '@safe-global/sdk-starter-kit' const safeClient = await createSafeClient({ provider, signer, safeAddress: '0x...' // The address of the Safe }) const bundlerOptions: BundlerOptions = { bundlerUrl: 'https://...' // URL of the bundler service } const paymasterOptions: PaymasterOptions = { isSponsored: true, // Optional: Indicates if the transaction is sponsored paymasterUrl: 'https://...', // Optional: URL of the paymaster service sponsorshipPolicyId: 'abc', // Optional: ID of the sponsorship policy paymasterAddress: '0x...', // Optional: Address of the paymaster paymasterTokenAddress: '0x...', // Optional: Address of the paymaster token amountToApprove: 123n // Optional: Amount to approve for the paymaster } export const safeOperationsClient = await safeClient.extend( safeOperations(bundlerOptions, paymasterOptions) ) ``` -------------------------------- ### Get Safe Creation Info with Specific Address Source: https://github.com/safe-global/safe-docs/blob/main/pages/reference-sdk-api-kit/getsafecreationinfo.mdx This example demonstrates calling `getSafeCreationInfo` with a hardcoded Safe address. It highlights the `safeAddress` parameter. ```typescript const safeCreationInfo = await apiKit.getSafeCreationInfo( '0x...' ) ``` -------------------------------- ### Get Transactions with Offset Source: https://github.com/safe-global/safe-docs/blob/main/pages/reference-sdk-api-kit/getalltransactions.mdx Fetches transactions for a Safe account, specifying the starting index for the results using the `offset` option. This is useful for pagination. ```typescript const allTxs = await apiKit.getAllTransactions(safeAddress, { offset: 20 }) ``` -------------------------------- ### Create lib Folder Source: https://github.com/safe-global/safe-docs/blob/main/pages/advanced/passkeys/tutorials/react-native.mdx Create a 'lib' directory at the project root to house the passkey logic. ```bash mkdir lib cd lib ``` -------------------------------- ### Run Production Server Source: https://github.com/safe-global/safe-docs/blob/main/README.md Start the project server in production mode after building. ```bash pnpm start ``` -------------------------------- ### Get Safe Creation Status Source: https://github.com/safe-global/safe-docs/blob/main/components/ApiReference/generated/celo-sepolia-reference.mdx Retrieves the status of a Safe creation process. This method is part of the setup process for creating a new Safe. ```APIDOC ## Get Safe Creation Status ### Description Retrieves the status of a Safe creation process. This method is part of the setup process for creating a new Safe. ### Method POST ### Endpoint /api/v1/safes/creation-status ### Parameters #### Request Body - **_owners** (address[]) - Required - An array of owner addresses for the Safe. - **_threshold** (uint256) - Required - The signature threshold required for Safe transactions. - **to** (address) - Optional - The recipient address for the Safe creation. - **data** (bytes) - Optional - Additional data for the Safe creation. - **fallbackHandler** (address) - Optional - The fallback handler address. - **paymentToken** (address) - Optional - The payment token address. - **payment** (uint256) - Optional - The payment amount. - **paymentReceiver** (address) - Optional - The address receiving the payment. ### Request Example ```json { "dataDecoded": { "method": "setup", "parameters": [ { "name": "_owners", "type": "address[]", "value": [ "0xa6d3DEBAAB2B8093e69109f23A75501F864F74e2", "0x3A16E3090e32DDeD2250E862B9d5610BEF13e93d" ] }, { "name": "_threshold", "type": "uint256", "value": "2" }, { "name": "to", "type": "address", "value": "0x0000000000000000000000000000000000000000" }, { "name": "data", "type": "bytes", "value": "0x" }, { "name": "fallbackHandler", "type": "address", "value": "0x017062a1dE2FE6b99BE3d9d37841FeD19F573804" }, { "name": "paymentToken", "type": "address", "value": "0x0000000000000000000000000000000000000000" }, { "name": "payment", "type": "uint256", "value": "0" }, { "name": "paymentReceiver", "type": "address", "value": "0x0000000000000000000000000000000000000000" } ] }, "userOperation": null } ``` ``` -------------------------------- ### Get Pending Safe Operations with Offset Source: https://github.com/safe-global/safe-docs/blob/main/pages/reference-sdk-api-kit/getpendingsafeoperations.mdx Demonstrates how to paginate through pending Safe operations by specifying an `offset`. This parameter determines the starting point for the results. ```typescript const safeOperationsResponse = await apiKit.getPendingSafeOperations( { safeAddress: '0x...', offset: 50 } ) ``` -------------------------------- ### Setup Protocol Kit for Safe Deployment Source: https://github.com/safe-global/safe-docs/blob/main/pages/reference-sdk-protocol-kit/deployment/createsafedeploymenttransaction.mdx This snippet shows how to initialize the Protocol Kit with necessary configuration for deploying a Safe. It includes defining owners, threshold, and optional deployment configurations. ```typescript import Safe, PredictedSafeProps, SafeAccountConfig, SafeDeploymentConfig from '@safe-global/protocol-kit' const safeAccountConfig: SafeAccountConfig = { owners: ['0x...', '0x...', '0x...'], threshold: 2, to: '0x...', // Optional data: '0x', // Optional fallbackHandler: '0x...', // Optional paymentToken: '', // Optional payment: 123, // Optional paymentReceiver: '0x...' // Optional } const safeDeploymentConfig: SafeDeploymentConfig = { saltNonce: '123', // Optional safeVersion: '1.4.1', // Optional deploymentType: 'canonical' // Optional } const predictedSafe: PredictedSafeProps = { safeAccountConfig, safeDeploymentConfig // Optional } const protocolKit = await Safe.init({ provider, signer, predictedSafe }) ``` -------------------------------- ### List Delegates Request Source: https://github.com/safe-global/safe-docs/blob/main/components/ApiReference/generated/base-sepolia-reference.mdx Example of how to make a GET request to the delegates endpoint to retrieve a list of delegates. Ensure to include your API key for authorization. ```bash curl -X GET https://api.safe.global/tx-service/basesep/api/v2/delegates/ \ -H "Accept: application/json" \ -H "content-type: application/json" \ -H "Authorization: Bearer YOUR_API_KEY" \ ``` -------------------------------- ### Get Multisig Transaction by Hash (TypeScript) Source: https://github.com/safe-global/safe-docs/blob/main/components/ApiReference/generated/chiado-reference.mdx Use this TypeScript example to retrieve a multisig transaction by its hash. Ensure you have the correct API key and endpoint. ```typescript // from ../examples/chiado/-v2-multisig-transactions-{safe_tx_hash}--get.ts ``` -------------------------------- ### Get Balance with Custom Configuration Source: https://github.com/safe-global/safe-docs/blob/main/pages/reference-sdk-react-hooks/usesafe/getbalance.mdx This example shows how to call `getBalance` with a custom configuration object. The `config` object allows overriding the default settings from `SafeProvider`. ```typescript import { config } from './config.ts' const result = getBalance({ config }) ``` ```typescript import { createConfig } from '@safe-global/safe-react-hooks' import { sepolia } from 'viem/chains' export const config = createConfig({ chain: sepolia, provider, signer, safeAddress: '0x...' }) ``` -------------------------------- ### Get Safe Operations by Address (Basic) Source: https://github.com/safe-global/safe-docs/blob/main/pages/reference-sdk-api-kit/getsafeoperationsbyaddress.mdx A minimal example to retrieve Safe operations for a Safe address without any specific options. This will return all operations by default. ```typescript const safeOperationsResponse = await apiKit.getSafeOperationsByAddress({ safeAddress: '0x...' }) ``` -------------------------------- ### Create components folder and LoginWithPasskey.tsx Source: https://github.com/safe-global/safe-docs/blob/main/pages/advanced/passkeys/tutorials/react.mdx Sets up the components directory and creates the LoginWithPasskey.tsx file for user authentication. ```bash cd .. mkdir components cd components touch LoginWithPasskey.tsx ``` -------------------------------- ### Install Project Dependencies Source: https://github.com/safe-global/safe-docs/blob/main/pages/advanced/passkeys/tutorials/nuxt.mdx Installs necessary dependencies including Safe Core SDK (Relay Kit, Protocol Kit), viem, Pinia for state management, and Vite node polyfills. ```bash pnpm add @safe-global/protocol-kit@4.1.0 @safe-global/relay-kit@3.1.0 viem @pinia/nuxt vite-plugin-node-polyfills ``` -------------------------------- ### Get Confirmations Source: https://github.com/safe-global/safe-docs/blob/main/components/ApiReference/generated/base-reference.mdx Fetches a paginated list of confirmations for a multisig transaction using its unique hash. You can control the number of results per page and the starting offset. ```APIDOC ## GET /api/v1/safe-operations/{safe_operation_hash}/confirmations/ ### Description Get the list of confirmations for a multisig transaction. ### Method GET ### Endpoint /api/v1/safe-operations/{safe_operation_hash}/confirmations/ ### Parameters #### Path Parameters - **safe_operation_hash** (string) - Required - The unique hash of the multisig transaction. #### Query Parameters - **limit** (integer) - Optional - Number of results to return per page. - **offset** (integer) - Optional - The initial index from which to return the results. ### Request Example ```bash curl -X GET https://api.safe.global/tx-service/base/api/v1/safe-operations/0x597ba36c626a32a4fcc9f23a4b25605ee30b46584918d6b6442387161dc3c51b/confirmations/ \ -H "Accept: application/json" \ -H "content-type: application/json" \ -H "Authorization: Bearer YOUR_API_KEY" \ ``` ### Response #### Success Response (200) - **count** (integer) - The total number of confirmations. - **next** (string) - URL for the next page of results. - **previous** (string) - URL for the previous page of results. - **results** (array) - An array of confirmation objects. - **created** (string) - The date and time the confirmation was created. - **modified** (string) - The date and time the confirmation was last modified. - **owner** (string) - The address of the owner who provided the confirmation. - **signature** (string) - The signature provided by the owner. - **signatureType** (string) - The type of signature. #### Response Example ```json { "count": 1, "next": null, "previous": null, "results": [ { "created": "2024-07-22T10:00:18.898708Z", "modified": "2024-07-22T10:00:18.898708Z", "owner": "0x608Cf2e3412c6BDA14E6D8A0a7D27c4240FeD6F1", "signature": "0x000000000000000000000000608cf2e3412c6bda14e6d8a0a7d27c4240fed6f10000000000000000000000000000000000000000000000000000000000000041000000000000000000000000000000000000000000000000000000000000000e053c4ce48756bae15e3454ad75ee8d4ba9764ea37ed561b216701c3630c0521774f94a8b7351780daa4a241792f52089af776e0898185318053201a92865b08d0000000000000000000000000000000000000000000000000000000000000002549960de5880e8c687434170f6476605b8fe4aeb9a28632c7995cf3ba831d97631d0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000034226f726967696e223a22687474703a2f2f6c6f63616c686f73743a33303030222c2263726f73734f726967696e223a66616c736500000000000000000000001f", "signatureType": "CONTRACT_SIGNATURE" } ] } ``` ``` -------------------------------- ### Create and Validate a Safe Transaction Source: https://github.com/safe-global/safe-docs/blob/main/pages/reference-sdk-protocol-kit/transactions/isvalidtransaction.mdx This example demonstrates how to create a Safe transaction and then validate it using `isValidTransaction`. It includes the necessary imports and setup for Protocol Kit. ```typescript import { MetaTransactionData, OperationType, TransactionOptions } from '@safe-global/types-kit' import { protocolKit } from './setup.ts' const transactions: MetaTransactionData[] = [{ to: '0x...', value: '123', data: '0x', operation: OperationType.Call // Optional }] const safeTransaction = await protocolKit.createTransaction({ transactions }) const options: TransactionOptions = { from: '0x...', // Optional gasLimit: '123', // Optional gasPrice: '123', // Optional maxFeePerGas: '123', // Optional maxPriorityFeePerGas: '123', // Optional nonce: 123 // Optional } const isValidTx = await protocolKit.isValidTransaction( safeTransaction, options // Optional ) ``` ```typescript import Safe from '@safe-global/protocol-kit' export const protocolKit = Safe.init({ provider, signer, safeAddress: '0x...' }) ``` -------------------------------- ### Initialize Hardhat Project Source: https://github.com/safe-global/safe-docs/blob/main/pages/advanced/smart-account-fallback-handler/smart-account-fallback-handler-tutorial.mdx Initializes a new Hardhat project, creating the necessary configuration files. ```bash npx hardhat init ``` -------------------------------- ### Get Owners Who Approved Transaction with Specific Hash Source: https://github.com/safe-global/safe-docs/blob/main/pages/reference-sdk-protocol-kit/safe-info/getownerswhoapprovedtx.mdx A focused example demonstrating how to call `getOwnersWhoApprovedTx` with a hardcoded transaction hash. This is useful for testing or specific use cases. ```typescript const ownerAddresses = await protocolKit.getOwnersWhoApprovedTx( '0x...' ) ```