-
Notifications
You must be signed in to change notification settings - Fork 6
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
Remove ProjectID, Add GHA #17
Changes from 7 commits
76911f0
dbf0188
580ba32
25b30ac
07193d9
95da6b6
b1db842
a08e9d3
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
name: TypeScript Lint | ||
|
||
on: | ||
push: | ||
# branches: | ||
# - master | ||
pull_request: | ||
|
||
permissions: | ||
contents: read | ||
|
||
jobs: | ||
lint: | ||
name: lint | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: actions/setup-node@v4 | ||
with: | ||
node-version: "20.x" | ||
registry-url: "https://registry.npmjs.org" | ||
- run: npm ci | ||
- name: Run linter | ||
run: npm run lint |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,11 +15,11 @@ jobs: | |
contents: read | ||
id-token: write | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: actions/setup-node@v3 | ||
- uses: actions/checkout@v4 | ||
- uses: actions/setup-node@v4 | ||
with: | ||
node-version: '18.x' | ||
registry-url: 'https://registry.npmjs.org' | ||
node-version: "20.x" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. curious if we need to update our require node version docs anywhere else ? not sure. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hmmm. I moved to |
||
registry-url: "https://registry.npmjs.org" | ||
- run: npm install -g npm@^9.5.0 | ||
- run: npm ci | ||
- run: npm publish --provenance --access public | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -37,3 +37,6 @@ staking-client-* | |
dist/ | ||
|
||
node_modules/ | ||
|
||
# VSCode configuration | ||
.vscode |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -37,10 +37,9 @@ import { StakingClient } from "@coinbase/staking-client-library-ts"; | |
const client = new StakingClient(); | ||
|
||
client.Ethereum.stake( | ||
'your-project-id', // replace with your project id | ||
'holesky', | ||
true, | ||
'your-wallet-address', // replace with your wallet address | ||
'0xdb816889F2a7362EF242E5a717dfD5B38Ae849FE', // replace with your wallet address | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. can we roll this back ? or was this intentional ? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Per offline discussion: Will keep in for simplicity of the example 😄. |
||
'0xA55416de5DE61A0AC1aa8970a280E04388B1dE4b', | ||
'123', | ||
) | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,7 +9,6 @@ import { | |
import { Workflow } from '../../src/gen/coinbase/staking/orchestration/v1/workflow.pb'; | ||
import { calculateTimeDifference } from '../../src/utils/date'; | ||
|
||
const projectId: string = ''; // replace with your project id | ||
const privateKey: string = ''; // replace with your private key | ||
const walletAddress: string = ''; // replace with your wallet address | ||
const validatorAddress: string = 'beefKGBWeSpHzYBHZXwp5So7wdQGX6mu4ZHCsH3uTar'; // replace with your validator address | ||
|
@@ -21,9 +20,9 @@ const client = new StakingClient(); | |
const signer = TxSignerFactory.getSigner('solana'); | ||
|
||
async function stakeSolana(): Promise<void> { | ||
if (projectId === '' || walletAddress === '') { | ||
if (walletAddress === '') { | ||
throw new Error( | ||
'Please set the projectId and stakerAddress variables in this file', | ||
'Please set the privateKey and stakerAddress variables in this file', | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yup, good catch. I'll double check these error messages in this repo to ensure they're correct as well. |
||
); | ||
} | ||
|
||
|
@@ -35,7 +34,6 @@ async function stakeSolana(): Promise<void> { | |
try { | ||
// Create a new solana stake workflow | ||
workflow = await client.Solana.stake( | ||
projectId, | ||
network, | ||
walletAddress, | ||
validatorAddress, | ||
|
@@ -71,7 +69,7 @@ async function stakeSolana(): Promise<void> { | |
// If the workflow is waiting for external broadcast, sign and broadcast the unsigned tx externally and return back the tx hash via the PerformWorkflowStep API. | ||
// Note: In this example, we just log this message as the wallet provider needs to implement this logic. | ||
try { | ||
workflow = await client.getWorkflow(projectId, workflowId); | ||
workflow = await client.getWorkflow(workflowId); | ||
} catch (error) { | ||
// TODO: add retry logic for network errors | ||
if (error instanceof Error) { | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,6 @@ | ||
import { StakingClient } from '../../src/client/staking-client'; | ||
import { Workflow } from '../../src/gen/coinbase/staking/orchestration/v1/workflow.pb'; | ||
|
||
const projectId: string = ''; // replace with your project id | ||
const walletAddress: string = ''; // replace with your wallet address | ||
const validatorAddress: string = 'beefKGBWeSpHzYBHZXwp5So7wdQGX6mu4ZHCsH3uTar'; // replace with your validator address | ||
const amount: string = '100000000'; // replace with your amount. For solana it should be >= 0.1 SOL | ||
|
@@ -10,18 +9,15 @@ const network: string = 'mainnet'; // replace with your network | |
const client = new StakingClient(); | ||
|
||
async function stakeSolana(): Promise<void> { | ||
if (projectId === '' || walletAddress === '') { | ||
throw new Error( | ||
'Please set the projectId and stakerAddress variables in this file', | ||
); | ||
if (walletAddress === '') { | ||
throw new Error('Please set the stakerAddress variable in this file'); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nit: walletAddress There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fixed! |
||
} | ||
|
||
let workflow: Workflow = {} as Workflow; | ||
|
||
try { | ||
// Create a new solana stake workflow | ||
workflow = await client.Solana.stake( | ||
projectId, | ||
network, | ||
walletAddress, | ||
validatorAddress, | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is this needed ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch. I commented for testing initially, but I'll uncomment now 😄.