-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3 from StauroDEV/jamesmccomish/master
#1 cleanup + add delegates
- Loading branch information
Showing
44 changed files
with
2,536 additions
and
1,687 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
# Account Variables | ||
PK= | ||
|
||
# Test Variables | ||
VITE_TEST_NETWORK_TYPE='ETHEREUM_SEPOLIA' | ||
VITE_ANVIL_SAFE_ADDRESS='SHORTNAME:ADDRESS' # sep:0xbcA814Ee6E571d0BbC335b4e3869F89E532Ba8B8 | ||
VITE_TEST_ADDRESS= # sep:0xD7a0ca30F71cFDF45534B058c567a5FaE6C33846 | ||
VITE_ANVIL_FORK_URL=https://rpc.sepolia.dev | ||
VITE_ANVIL_BLOCK_NUMBER=5211612 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{ | ||
"editor.formatOnSave": false, | ||
"eslint.experimental.useFlatConfig": true, | ||
"editor.codeActionsOnSave": { | ||
"source.fixAll": "explicit" | ||
}, | ||
"typescript.tsdk": "node_modules/typescript/lib" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import eslint from '@eslint/js' | ||
import tseslint from 'typescript-eslint' | ||
import stylistic from '@stylistic/eslint-plugin' | ||
|
||
const config = tseslint.config( | ||
{ | ||
files: ['src/**/*.ts', 'src/*.tsx'], | ||
ignores: ['node_modules', 'dist', '.next'], | ||
}, | ||
eslint.configs.recommended, | ||
...tseslint.configs.recommended, | ||
stylistic.configs.customize({ | ||
indent: 2, | ||
quotes: 'single', | ||
jsx: true, | ||
semi: false, | ||
}), | ||
{ | ||
settings: { | ||
react: { | ||
version: 'detect', | ||
}, | ||
}, | ||
plugins: { | ||
stylistic, | ||
}, | ||
rules: { | ||
'stylistic/no-multiple-empty-lines': ['error', { max: 1 }], | ||
}, | ||
}, | ||
) | ||
|
||
export default config |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import { ApiClient } from '../src/api.js' | ||
import { sepolia } from 'viem/chains' | ||
import { EIP3770Address } from '../src/types.js' | ||
import { createWalletClient, http, Hex, Address } from 'viem' | ||
import { privateKeyToAccount } from 'viem/accounts' | ||
import { generateSafeDelegateSignature } from '../src/actions.js' | ||
|
||
const safeAddress = process.env.SAFE_ADDRESS as EIP3770Address | ||
|
||
const delegate = process.env.SAFE_DELEGATE as Address | ||
|
||
const apiClient = new ApiClient({ url: 'https://safe-transaction-sepolia.safe.global', safeAddress, chainId: sepolia.id }) | ||
|
||
const walletClient = createWalletClient({ | ||
transport: http(), | ||
chain: sepolia, | ||
account: privateKeyToAccount(process.env.PK as Hex), | ||
}) | ||
|
||
const signature = await generateSafeDelegateSignature(walletClient, { | ||
delegate, | ||
}) | ||
|
||
await apiClient.createDelegate({ | ||
delegate, | ||
delegator: walletClient.account.address, | ||
signature, | ||
label: 'Delegate #1', | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,15 @@ | ||
import { ApiClient } from '../src/api.js' | ||
import { goerli } from 'viem/chains' | ||
import { sepolia } from 'viem/chains' | ||
import { EIP3770Address } from '../src/types.js' | ||
|
||
const safeAddress = process.env.SAFE_ADDRESS as EIP3770Address | ||
|
||
const apiClient = new ApiClient({ url: 'https://safe-transaction-goerli.safe.global', safeAddress, chainId: goerli.id }) | ||
const apiClient = new ApiClient({ url: 'https://safe-transaction-sepolia.safe.global', safeAddress, chainId: sepolia.id }) | ||
|
||
const response = await apiClient.getDelegates({ limit:'100' }) | ||
const response = await apiClient.getDelegates({ limit: '100' }) | ||
|
||
console.log(`List of delegates for ${safeAddress}:\n`) | ||
|
||
for (const delegate of response.results) { | ||
console.log(`${delegate.label}: ${delegate.delegate}`) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.