-
Notifications
You must be signed in to change notification settings - Fork 0
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: remove sdk
network, add more exports
#80
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
@@ -34,19 +30,6 @@ export const createPublicClientForChain: ( | |||
transport: http(), | |||
}); | |||
|
|||
// Creates a wallet client for the given chain with a browser wallet provider | |||
export const walletClientFromBrowser = ( |
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.
i realized web-based wallets dont really work with the sdk
wrt executing transactions, so i removed this.
we could either choose to try and make web-based wallet flows work in the sdk
, or just (eventually) publish the sdkx
package—and i think the latter was already the plan. maybe we call sdkx
the @recallnet/web
package or something.
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.
Yea sounds like a good plan to eventually publish the react sdk.
@@ -84,7 +82,8 @@ export class RecallClient { | |||
} | |||
const chain = this.publicClient.chain; | |||
if (!chain) throw new Error("missing chain in provided client"); | |||
this.network = config.network ?? Network.fromChain(chain); | |||
this.subnetId = SubnetId.fromChain(chain); |
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.
need for cross-chain flows like deposits and withdrawals. (this used to be part of the Network
, which we've removed.)
const override = | ||
contractAddress ?? | ||
overrideSupplySourceAddress ?? | ||
deployedSupplySourceAddress; |
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.
note: this pattern appears in a couple of places. i didn't want to overhaul the AccountManager
etc too much, but it's a little messy imo. i'll take another pass in a different PR on refactoring a few other pieces in #79
).read.balanceOf(args); | ||
await reset(); | ||
return { | ||
result: { address: addr, nonce, balance: balance.result, parentBalance }, | ||
}; | ||
} | ||
|
||
// Approve a spender to transfer funds from the account | ||
async approve(spender: Address, amount: bigint): Promise<Result> { | ||
// Approve a spender to transfer funds from the account. Assumes the wallet client is on the |
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.
and note: i'll also handle adding docstrings to our public packages in #77
contractAddress?: Address, | ||
publicClient: PublicClient, | ||
walletClient: WalletClient, | ||
contractAddress: Address, |
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.
Note: this pattern is probably needed in the entities
(buckets, blobs, etc) since RecallClient
instantiates each entity, but then the entity itself takes a RecallClient
in its constructor. It's self-referencing and not ideal, but I wanted to keep the PR small and can handle that later. will handle in #79
c83fcdb
to
04b4609
Compare
61c6cda
to
1384042
Compare
@@ -120,3 +132,65 @@ export const createFileHandler = (): FileHandler => ({ | |||
}; | |||
}, | |||
}); | |||
|
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.
these arent "new"—we simply merged a couple of utils
files into a single one
@asutula i started to refactor some pieces from the i didnt want this PR to get too complicated, so i plan to do another refactor pass in the future. the tests all pass locally, so this all works for now. once we merge this, i can merge #75, which will create a new release that accounts for the RPC changes in a989499 as well as these SDK changes |
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.
Nice.
# Releases ## @recallnet/chains@0.0.2 ### Patch Changes - Updated dependencies \[[`a989499`](a989499)]: - @recallnet/network-constants@0.0.2 ## @recallnet/network-constants@0.0.2 ### Patch Changes - [#74](#74) [`a989499`](a989499) Thanks [@dtbuchholz](https://github.com/dtbuchholz)! - use stable RPC URLs instead of versioned subdomain ## @recallnet/sdk@0.0.3 ### Patch Changes - [#80](#80) [`2923bb8`](2923bb8) Thanks [@dtbuchholz](https://github.com/dtbuchholz)! - remove legacy 'network' logic and use viem chains everywhere - Updated dependencies \[[`a989499`](a989499)]: - @recallnet/network-constants@0.0.2 - @recallnet/chains@0.0.2 - @recallnet/contracts@0.0.1 Co-authored-by: textileio-machine <40302381+textileio-machine@users.noreply.github.com>
network.ts
, which was legacy code that tried to emulaterust-recall
patternsentities/index.ts
barrel file, moveutils
anderrors
into root, and export them so they're usable elsewhereprovider.ts
into rootGatewayManager
pattern to take a public client, wallet client, and contract overrides—instead of taking theRecallClient
that posses these values. This requiredAccountManager
to go through some refactoring to account for this.