Conversation
# Conflicts: # packages/sdk/src/index.ts # packages/sdk/src/types.ts
mpetrunic
left a comment
There was a problem hiding this comment.
I think it would make sense to intrudce custom error classes for handling errors
| "https://gopher.test.buildwithsygma.com/" | ||
| ); | ||
| export function setBaseUrl(url: string): void { | ||
| BASE_URL = url; |
There was a problem hiding this comment.
why not set process.env instead?
There was a problem hiding this comment.
and you end up in vite that does not to useprocess.env but there is import.meta.env, made helper method to solve this problem and the setter is in a case you have no options to provide .env like in React you need use prefix REACT_ for env's
packages/sdk/src/api.ts
Outdated
| if (whitelistedSourceChains && whitelistedSourceChains.length) | ||
| url.searchParams.set( | ||
| "whitelistedSourceChains", | ||
| whitelistedSourceChains.toString() |
There was a problem hiding this comment.
| whitelistedSourceChains.toString() | |
| whitelistedSourceChains.join(",") |
?
There was a problem hiding this comment.
it is the same result
const a = [1,2,3,4];
a.join();
// '1,2,3,4'
a.join(',');
// '1,2,3,4'
a.toString();
// '1,2,3,4'There was a problem hiding this comment.
but you're using one extra character! 🤣
There was a problem hiding this comment.
I was going to argue it's more expressive 😂
There was a problem hiding this comment.
I wanted but been layz to make benchmarks.
But it is on mu super "short" TODO list for personal projects
| const noNetworkFound: Chain = { | ||
| chainID: 0, | ||
| chainType: 'evm', | ||
| name: 'none', | ||
| logoURI: 'https://static.thenounproject.com/png/75231-200.png', | ||
| rpcurls: [] | ||
| }; |
There was a problem hiding this comment.
same as last comment, just an observation, maybe satisfies would be more appropriate here
| const noNetworkFound: Chain = { | |
| chainID: 0, | |
| chainType: 'evm', | |
| name: 'none', | |
| logoURI: 'https://static.thenounproject.com/png/75231-200.png', | |
| rpcurls: [] | |
| }; | |
| const noNetworkFound = { | |
| chainID: 0, | |
| chainType: 'evm', | |
| name: 'none', | |
| logoURI: 'https://static.thenounproject.com/png/75231-200.png', | |
| rpcurls: [] | |
| } satisfies Chain; |
| whitelistedSourceChains | ||
| ); | ||
| return Promise.resolve([]); | ||
| const tokenList = tokens || (await this.getAvailableTokens()); |
There was a problem hiding this comment.
should we getAvailableTokens if provided tokens array is empty too?
There was a problem hiding this comment.
This tricky question is like if you set an intentionally empty array (it is not logical to do) as an optional parameter and you got the result that is not part that reflects that array.
| variable = env[envName]; | ||
| } | ||
| } finally { | ||
| variable ??= defaultValue; |
There was a problem hiding this comment.
packages/sdk/src/types.ts
Outdated
| export type ChainID = number; | ||
|
|
||
| export interface FungibleToken { | ||
| addresses: { [chainID: ChainID]: Address }; |
There was a problem hiding this comment.
nit: this can also be a Record<ChainID, Address>, but no need to update
🤖 I have created a release *beep* *boop* --- ## [0.1.0](sprinter-sdk-v0.0.1...sprinter-sdk-v0.1.0) (2024-09-12) ### Features * api options ([#33](#33)) ([ad1cb88](ad1cb88)) * cross chain contract call ([#21](#21)) ([69c0128](69c0128)) * depricate provider param from sdk ([#41](#41)) ([72297fe](72297fe)) * docs POC ([#14](#14)) ([8cd800d](8cd800d)) * erc20 with contract call ([#39](#39)) ([77e1d8d](77e1d8d)), closes [#38](#38) * native tokens transfers ([#40](#40)) ([d4edf35](d4edf35)), closes [#36](#36) * SDK POC ([#11](#11)) ([6aca865](6aca865)) * web poc (super basic basic) ([#3](#3)) ([25a91f7](25a91f7)) ### Bug Fixes * process approvals from quote ([#26](#26)) ([95d9ebf](95d9ebf)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
🤖 I have created a release *beep* *boop* --- <details><summary>sprinter-sdk: 0.3.0</summary> ## [0.3.0](sprinter-sdk-v0.2.0...sprinter-sdk-v0.3.0) (2024-09-23) ### Features * api options ([#33](#33)) ([ad1cb88](ad1cb88)) * cross chain contract call ([#21](#21)) ([69c0128](69c0128)) * depricate provider param from sdk ([#41](#41)) ([72297fe](72297fe)) * docs POC ([#14](#14)) ([8cd800d](8cd800d)) * erc20 with contract call ([#39](#39)) ([77e1d8d](77e1d8d)), closes [#38](#38) * implement tracing url resolver ([#46](#46)) ([efd1be3](efd1be3)), closes [#44](#44) * native tokens transfers ([#40](#40)) ([d4edf35](d4edf35)), closes [#36](#36) * react sdk context ([#48](#48)) ([39dbe7e](39dbe7e)), closes [#47](#47) * SDK POC ([#11](#11)) ([6aca865](6aca865)) * web poc (super basic basic) ([#3](#3)) ([25a91f7](25a91f7)) ### Bug Fixes * process approvals from quote ([#26](#26)) ([95d9ebf](95d9ebf)) </details> <details><summary>sprinter-react: 0.2.0</summary> ## [0.2.0](sprinter-react-v0.1.0...sprinter-react-v0.2.0) (2024-09-23) ### Features * react sdk context ([#48](#48)) ([39dbe7e](39dbe7e)), closes [#47](#47) ### Bug Fixes * cd and rect hooks export ([#52](#52)) ([33c0604](33c0604)) </details> --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Draft, POC