Skip to content

Commit e3c160f

Browse files
2 parents 8d928e9 + 8874bf0 commit e3c160f

File tree

119 files changed

+6425
-1095
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

119 files changed

+6425
-1095
lines changed

.github/prompts/code-review.md

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
# Code Review Prompt for BitGoJS
2+
3+
You are an expert code reviewer for the BitGoJS cryptocurrency wallet SDK. Please review the changes in this pull request with focus on:
4+
5+
## Security & Cryptography
6+
- Cryptographic implementations and key handling
7+
- Security best practices for cryptocurrency operations
8+
- Proper validation of transaction parameters
9+
- Safe handling of private keys and sensitive data
10+
11+
## Code Quality & Architecture
12+
- Adherence to BitGoJS coding standards and patterns
13+
- TypeScript type safety and interface compliance
14+
- Proper error handling and edge cases
15+
- Code organization and maintainability
16+
17+
## Testing & Coverage
18+
- Test coverage for new functionality
19+
- Edge case testing for cryptocurrency operations
20+
- Integration test considerations
21+
- Mock implementations and test data safety
22+
23+
## BitGoJS Specific Concerns
24+
- Compliance with existing coin SDK patterns
25+
- Proper inheritance from base classes (BaseCoin, AbstractUtxoCoin, etc.)
26+
- Transaction serialization and deserialization correctness
27+
- Multi-signature wallet compatibility
28+
- Fee calculation accuracy
29+
30+
## Performance & Compatibility
31+
- Memory usage and performance implications
32+
- Node.js and browser compatibility
33+
- Dependency management and security
34+
- Breaking changes to public APIs
35+
36+
Please provide constructive feedback focusing on:
37+
1. Critical issues that must be addressed
38+
2. Suggestions for improvement
39+
3. Questions about design decisions
40+
4. Acknowledgment of good practices
41+
42+
Be thorough but concise, and explain the reasoning behind your suggestions.

.github/workflows/ci.yml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,43 @@ jobs:
134134
if: matrix.check == 'audit'
135135
run: yarn run improved-yarn-audit --min-severity high
136136

137+
license-analysis:
138+
runs-on: ubuntu-latest
139+
140+
steps:
141+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
142+
143+
- name: Setup node 22
144+
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
145+
with:
146+
node-version: 22
147+
148+
- name: restore lerna dependencies
149+
id: lerna-cache
150+
uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 #v4.2.3
151+
with:
152+
path: |
153+
node_modules
154+
modules/*/node_modules
155+
key: ${{ runner.os }}-node22-${{ hashFiles('yarn.lock') }}-${{ hashFiles('tsconfig.packages.json') }}-${{ hashFiles('package.json') }}
156+
157+
- name: Install Packages
158+
if: steps.lerna-cache.outputs.cache-hit != 'true'
159+
run: yarn install --with-frozen-lockfile --ignore-scripts
160+
161+
- name: build packages
162+
env:
163+
# Workaround for https://github.com/nodejs/node/issues/51555
164+
DISABLE_V8_COMPILE_CACHE: '1'
165+
run: yarn run postinstall
166+
167+
- name: Run Fossa Analysis
168+
uses: fossas/fossa-action@3ebcea1862c6ffbd5cf1b4d0bd6b3fe7bd6f2cac # v1.7.0
169+
with:
170+
api-key: ${{ secrets.FOSSA_API_KEY }}
171+
branch: ${{ github.head_ref || github.ref_name }}
172+
project: BitGo/BitGoJS
173+
137174
browser-test:
138175
runs-on: ubuntu-22.04
139176

.github/workflows/claude-pr.yml

Lines changed: 105 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,105 @@
1+
name: Claude PR
2+
3+
permissions:
4+
contents: write
5+
pull-requests: write
6+
issues: write
7+
id-token: write
8+
9+
on:
10+
issue_comment:
11+
types: [created]
12+
pull_request_review_comment:
13+
types: [created]
14+
15+
jobs:
16+
claude-pr:
17+
if: |
18+
(github.event_name == 'issue_comment' && contains(github.event.comment.body, '@claude')) ||
19+
(github.event_name == 'pull_request_review_comment' && contains(github.event.comment.body, '@claude')) ||
20+
(github.event_name == 'issues' && contains(github.event.issue.body, '@claude'))
21+
runs-on: ubuntu-latest
22+
env:
23+
AWS_REGION: us-west-2
24+
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
25+
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
26+
AWS_SESSION_TOKEN: ${{ secrets.AWS_SESSION_TOKEN }}
27+
steps:
28+
- name: Checkout repository
29+
uses: actions/checkout@v5
30+
31+
- name: Configure AWS Credentials (OIDC)
32+
uses: aws-actions/configure-aws-credentials@v5
33+
with:
34+
role-to-assume: arn:aws:iam::199765120567:role/${{ github.event.repository.name }}-iam-protected
35+
aws-region: us-west-2
36+
37+
- name: Assume inference role
38+
id: inference-role
39+
run: |
40+
CREDS="$(aws sts assume-role \
41+
--role-arn arn:aws:iam::168000258654:role/BedrockInferenceRole \
42+
--role-session-name claude-inference-session \
43+
--query 'Credentials' \
44+
--output json)"
45+
46+
AWS_ACCESS_KEY_ID="$(echo "$CREDS" | jq -r '.AccessKeyId')"
47+
AWS_SECRET_ACCESS_KEY="$(echo "$CREDS" | jq -r '.SecretAccessKey')"
48+
AWS_SESSION_TOKEN="$(echo "$CREDS" | jq -r '.SessionToken')"
49+
50+
echo "::add-mask::$AWS_SECRET_ACCESS_KEY"
51+
{ echo "aws-access-key-id=$AWS_ACCESS_KEY_ID"; echo "aws-secret-access-key=$AWS_SECRET_ACCESS_KEY"; echo "aws-session-token=$AWS_SESSION_TOKEN"; } >> "$GITHUB_OUTPUT"
52+
53+
- name: Determine prompt to use
54+
id: determine-prompt
55+
env:
56+
COMMENT_BODY: ${{ github.event.comment.body }}
57+
run: |
58+
# Safely trim whitespace and check if it's just @claude
59+
TRIMMED_COMMENT=$(echo "$COMMENT_BODY" | xargs)
60+
61+
if [ "$TRIMMED_COMMENT" = "@claude" ]; then
62+
echo "use-code-review-prompt=true" >> "$GITHUB_OUTPUT"
63+
else
64+
echo "use-code-review-prompt=false" >> "$GITHUB_OUTPUT"
65+
fi
66+
67+
- name: Read code review prompt
68+
id: read-prompt
69+
if: steps.determine-prompt.outputs.use-code-review-prompt == 'true'
70+
run: |
71+
PROMPT_CONTENT=$(cat .github/prompts/code-review.md)
72+
{
73+
echo "prompt-content<<EOF"
74+
echo "$PROMPT_CONTENT"
75+
echo "EOF"
76+
} >> "$GITHUB_OUTPUT"
77+
78+
- uses: anthropics/claude-code-action@69dec299f882fef0fff1652a1309b7e9771b9f98
79+
if: steps.determine-prompt.outputs.use-code-review-prompt == 'true'
80+
env:
81+
AWS_REGION: us-west-2
82+
AWS_ACCESS_KEY_ID: ${{ steps.inference-role.outputs.aws-access-key-id }}
83+
AWS_SECRET_ACCESS_KEY: ${{ steps.inference-role.outputs.aws-secret-access-key }}
84+
AWS_SESSION_TOKEN: ${{ steps.inference-role.outputs.aws-session-token }}
85+
with:
86+
timeout_minutes: '10'
87+
github_token: ${{ secrets.GITHUB_TOKEN }}
88+
use_bedrock: 'true'
89+
anthropic_model: 'arn:aws:bedrock:us-west-2:168000258654:inference-profile/us.anthropic.claude-sonnet-4-20250514-v1:0'
90+
direct_prompt: ${{ steps.read-prompt.outputs.prompt-content }}
91+
92+
- uses: anthropics/claude-code-action@69dec299f882fef0fff1652a1309b7e9771b9f98
93+
if: steps.determine-prompt.outputs.use-code-review-prompt == 'false'
94+
env:
95+
AWS_REGION: us-west-2
96+
AWS_ACCESS_KEY_ID: ${{ steps.inference-role.outputs.aws-access-key-id }}
97+
AWS_SECRET_ACCESS_KEY: ${{ steps.inference-role.outputs.aws-secret-access-key }}
98+
AWS_SESSION_TOKEN: ${{ steps.inference-role.outputs.aws-session-token }}
99+
COMMENT_BODY: ${{ github.event.comment.body }}
100+
with:
101+
timeout_minutes: '10'
102+
github_token: ${{ secrets.GITHUB_TOKEN }}
103+
use_bedrock: 'true'
104+
anthropic_model: 'arn:aws:bedrock:us-west-2:168000258654:inference-profile/us.anthropic.claude-sonnet-4-20250514-v1:0'
105+
direct_prompt: $COMMENT_BODY
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
/**
2+
* Bulk sign account-based midnight claim messages for a wallet
3+
*
4+
* This example demonstrates how to use the BitGo API to sign multiple account-based midnight claim messages
5+
* in bulk for a given wallet. It shows how to initialize the BitGo SDK, retrieve a wallet, and use the
6+
* bulkSignAccountBasedMidnightClaimMessages utility to sign messages for a specified destination address.
7+
*
8+
* Usage:
9+
* - Configure your .env file with the appropriate TESTNET_ACCESS_TOKEN.
10+
* - Set the coin and wallet ID as needed.
11+
* - Optionally set the wallet passphrase if required for signing.
12+
*
13+
* Copyright 2025, BitGo, Inc. All Rights Reserved.
14+
*/
15+
16+
import {BitGoAPI} from '@bitgo/sdk-api';
17+
import {MessageStandardType, walletUtil} from "@bitgo/sdk-core";
18+
import {Tsol} from "@bitgo/sdk-coin-sol";
19+
require('dotenv').config({ path: '../../.env' });
20+
21+
const bitgo = new BitGoAPI({
22+
accessToken: process.env.TESTNET_ACCESS_TOKEN,
23+
env: 'test', // Change this to env: 'production' when you are ready for production
24+
});
25+
26+
// Set the coin name to match the blockchain and network
27+
// doge = dogecoin, tdoge = testnet dogecoin
28+
const coin = 'tsol';
29+
bitgo.register(coin, Tsol.createInstance);
30+
31+
const id = '';
32+
const walletPassphrase = '';
33+
34+
async function main() {
35+
const wallet = await bitgo.coin(coin).wallets().get({ id });
36+
console.log(`Wallet label: ${wallet.label()}`);
37+
38+
const adaTestnetDestinationAddress = '';
39+
40+
const response = await walletUtil.bulkSignAccountBasedMidnightClaimMessages(wallet, MessageStandardType.SIMPLE, adaTestnetDestinationAddress, walletPassphrase);
41+
console.dir(response);
42+
}
43+
44+
main().catch((e) => console.log(e));

0 commit comments

Comments
 (0)