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

feat: support greenfield chain in bnb plugin #1

Merged
merged 42 commits into from
Feb 21, 2025
Merged

feat: support greenfield chain in bnb plugin #1

merged 42 commits into from
Feb 21, 2025

Conversation

ybgbob
Copy link
Collaborator

@ybgbob ybgbob commented Jan 15, 2025

Background

What does this PR do?

Add Greenfield action

What kind of change is this?

  • gnfdAction.ts

Documentation changes needed?

Add env:

GREENFIELD_NETWORK=         # Greenfield network: `MAINNET` or `TESTNET`

Testing

Where should a reviewer start?

Detailed testing steps

@@ -51,6 +52,10 @@ export class WalletProvider {
return this.account.address;
}

getPk(): Address {
return this.pk;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have some security concerns regarding this approach. If we directly store the private key in plaintext, it poses a significant risk of exposure, especially since this is a public interface. Is there a way to reuse the sign method from the PrivateKeyAccount class for signing without compromising the private key?


export const InitGnfdClient = async (runtime: IAgentRuntime) => {
const rpcUrl = runtime.getSetting("GREENFIELD_RPC_URL");
const chainId = runtime.getSetting("GREENFIELD_CHAIN_ID");
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The Chain ID can be obtained from the RPC URL. Therefore, I believe users do not need to set this parameter to enhance their experience. You can get the chainID here: https://greenfield-chain-us.bnbchain.org/genesis?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How to configure testnet and mainnet easily?

default config?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The GREENFIELD_RPC_URL can be configured for both the mainnet and testnet. By utilizing this RPC URL, you can retrieve the chain ID using the above method.

.env.example Outdated
@@ -379,3 +379,5 @@ BNB_PRIVATE_KEY= # BNB chain private key
BNB_PUBLIC_KEY= # BNB-smart-chain public key (address)
BSC_PROVIDER_URL= # BNB-smart-chain rpc url
OPBNB_PROVIDER_URL= # OPBNB rpc url
GREENFIELD_RPC_URL= # Greenfield rpc url
Copy link
Collaborator

@unclezoro unclezoro Jan 15, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just relized that we need bridge token from BSC to gnfd... would you please add it in the bridge action?

ybgbob pushed a commit that referenced this pull request Jan 17, 2025
ybgbob pushed a commit that referenced this pull request Jan 17, 2025
Orchestrator architecture V1
ybgbob pushed a commit that referenced this pull request Jan 17, 2025
@clydemeng clydemeng changed the title Feat/gnfd feat: support greenfield chain in bnb plugin Feb 21, 2025
@clydemeng clydemeng merged commit 029a163 into defi Feb 21, 2025
5 of 8 checks passed
ybgbob pushed a commit that referenced this pull request Feb 21, 2025
ybgbob pushed a commit that referenced this pull request Feb 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants