Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update account.js #17

Open
wants to merge 11 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"image": "mcr.microsoft.com/devcontainers/universal:2",
"features": {
}
}
6 changes: 3 additions & 3 deletions .env.example
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
RPC_URL='YOUR_RPC_URL'
PRIVATE_KEY='YOUR_PRIVATE_KEY'
ACCOUNT_TYPE='simple' # simple, safe, kernel
RPC_URL='https://api.developer.coinbase.com/rpc/v1/base/RO192gK9MJo6ncL4sP3KSYwliEnGZGa7'
PRIVATE_KEY='6e01c7cd-5b9d-4312-af14-2ac541b3e941'
ACCOUNT_TYPE='simple' # simple, safe, kernel
8 changes: 4 additions & 4 deletions config.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import dotenv from 'dotenv'

// Updating path due to being executed in the examples/x directory
dotenv.config({ path: '../../.env' })
dotenv.config({ path: 'https://api.developer.coinbase.com/rpc/v1/base/RO192gK9MJo6ncL4sP3KSYwliEnGZGa7.env' })

export default {
"rpc_url": process.env.RPC_URL,
"private_key": process.env.PRIVATE_KEY,
"rpc_url": process.env.https://api.developer.coinbase.com/rpc/v1/base/RO192gK9MJo6ncL4sP3KSYwliEnGZGa7,
"private_key": process.env.6e01c7cd-5b9d-4312-af14-2ac541b3e941,
"account_type": process.env.ACCOUNT_TYPE || 'simple',
"contract_address": "0x66519FCAee1Ed65bc9e0aCc25cCD900668D3eD49",
"function_name": "mintTo",
"entry_point": "0x5FF137D4b0FDCD49DcA30c7CF57E578a026d2789"
}
}
4 changes: 2 additions & 2 deletions examples/pimlico/src/account.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { http, createPublicClient } from 'viem'
import config from '../../../config.js';

const publicClient = createPublicClient({
transport: http(config.rpc_url),
transport: http(config.https://api.pimlico.io/v2/137/rpc?apikey=ffdbc8d4-e8c4-4b88-840c-313b4ae13b38),
});

// To customize the signer, see https://docs.pimlico.io/permissionless/reference/accounts/signerToSimpleSmartAccount
Expand Down Expand Up @@ -44,4 +44,4 @@ export const getAccount = async (type) => {
default:
throw new Error("Invalid account type in config.json")
}
}
}
4 changes: 2 additions & 2 deletions examples/pimlico/src/mint.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { abi } from './abi.js';
import config from '../../../config.js';

// Get yours at https://www.coinbase.com/cloud/products/base/rpc
const rpcUrl = config.rpc_url
const rpcUrl = config.https://api.developer.coinbase.com/rpc/v1/base/RO192gK9MJo6ncL4sP3KSYwliEnGZGa7
const contractAddress = config.contract_address;

// Create the Cloud Paymaster
Expand Down Expand Up @@ -49,4 +49,4 @@ const txHash = await smartAccountClient.sendTransaction({
});

console.log("\x1b[32m", `⛽ Successfully sponsored gas for ${config.function_name} transaction with Coinbase Developer Platform!`);
console.log("\x1b[36m", `🔍 View on Etherscan: https://sepolia.basescan.org/tx/${txHash}`);
console.log("\x1b[36m", `🔍 View on Etherscan: https://sepolia.basescan.org/tx/${txHash}`);
16 changes: 16 additions & 0 deletions node_modules/.yarn-integrity

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

Loading