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

chore(PSDK-640): add network_id to WalletData #223

Merged
merged 1 commit into from
Dec 19, 2024
Merged

chore(PSDK-640): add network_id to WalletData #223

merged 1 commit into from
Dec 19, 2024

Conversation

0xRAG
Copy link
Contributor

@0xRAG 0xRAG commented Dec 18, 2024

What changed? Why?

It should be clear which saved wallets belong to which networks when you save_seed / export_data for a given wallet.

Qualified Impact

The network id should always be present, and if it is not, it will simply not be included in the WalletData

@cb-heimdall
Copy link

cb-heimdall commented Dec 18, 2024

🟡 Heimdall Review Status

Requirement Status More Info
Reviews 🟡 0/1
Denominator calculation
Show calculation
1 if user is bot 0
1 if user is external 0
From .codeflow.yml 1
Additional review requirements
Show calculation
Max 0
0
From CODEOWNERS 0
Global minimum 0
Max 1
1
1 if commit is unverified 0
Sum 1

@0xRAG 0xRAG requested a review from alex-stone December 18, 2024 16:09
@0xRAG 0xRAG marked this pull request as ready for review December 18, 2024 16:09
@0xRAG 0xRAG changed the base branch from master to v0.13.0 December 18, 2024 16:18
@@ -132,14 +132,15 @@ def fetch_wallets_page(page)
# If nil, a new seed will be generated. If the empty string, no seed is generated, and the Wallet will be
# instantiated without a seed and its corresponding private keys.
# with the Wallet. If not provided, the Wallet will derive the first default address.
def initialize(model, seed: nil)
def initialize(model, seed: nil, network_id: nil)
Copy link
Contributor

Choose a reason for hiding this comment

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

The network_id is also present on the model so we do not need to pass this in:

# Returns the Network of the Wallet.
# @return [Coinbase::Network] The Network of the Wallet
def network
@network ||= Coinbase::Network.from_id(@model.network_id)
end

We definitely should serialize it on the way out and we can do a sanity check on the way in too.

This exposes a pretty important concept/flaw that unfortunately we scoped wallets to network.,

@0xRAG 0xRAG merged commit 99d6197 into v0.13.0 Dec 19, 2024
10 checks passed
@0xRAG 0xRAG deleted the PSDK-640 branch December 19, 2024 14:57
@alex-stone alex-stone mentioned this pull request Dec 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants