Skip to content

Comments

feat: react sdk context#48

Merged
BeroBurny merged 14 commits intomasterfrom
beroburny/react-context
Sep 23, 2024
Merged

feat: react sdk context#48
BeroBurny merged 14 commits intomasterfrom
beroburny/react-context

Conversation

@BeroBurny
Copy link
Contributor

@BeroBurny BeroBurny commented Sep 23, 2024

closes #47

Comment on lines +150 to +165
private deferredRequest<T>(
name: string,
request: () => Promise<T>,
): Promise<T> {
if (!(name in this.#requests)) {
this.#requests[name] = request();
void this.#requests[name].finally(() => {
void setTimeout(() => {
delete this.#requests[name];
}, 1000);
});
}

return this.#requests[name] as Promise<T>;
}

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Curious, what do you think about this?

@github-actions github-actions bot temporarily deployed to gopher-poc (Preview) September 23, 2024 09:15 Inactive
@github-actions github-actions bot temporarily deployed to gopher-docs (Preview) September 23, 2024 09:16 Inactive
@BeroBurny BeroBurny marked this pull request as ready for review September 23, 2024 09:48
@github-actions github-actions bot temporarily deployed to gopher-poc (Preview) September 23, 2024 13:06 Inactive
@github-actions github-actions bot temporarily deployed to gopher-docs (Preview) September 23, 2024 13:06 Inactive
You can pass custom fetch options when initializing the context:

```tsx
<SprinterContext fetchOptions={{ baseUrl: "https://api.test.sprinter.buildwithsygma.com/" }}>
Copy link
Contributor

Choose a reason for hiding this comment

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

Seems like a centralized service, doesn't it make sense to choose from selectable environments rather than a connection string? Like SprinterEnvironment.Test or SprinterEnvironment.Main

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It defaults to mainnet and with that approach, we eliminate the need for updates for client's custom deployments or proxies

@github-actions github-actions bot temporarily deployed to gopher-poc (Preview) September 23, 2024 15:52 Inactive
@github-actions github-actions bot temporarily deployed to gopher-docs (Preview) September 23, 2024 15:53 Inactive
@github-actions github-actions bot temporarily deployed to gopher-poc (Preview) September 23, 2024 15:54 Inactive
@github-actions github-actions bot temporarily deployed to gopher-docs (Preview) September 23, 2024 15:55 Inactive
@BeroBurny BeroBurny merged commit 39dbe7e into master Sep 23, 2024
@github-actions github-actions bot mentioned this pull request Sep 23, 2024
BeroBurny pushed a commit that referenced this pull request Sep 23, 2024
🤖 I have created a release *beep* *boop*
---


<details><summary>sprinter-sdk: 0.2.0</summary>

##
[0.2.0](sprinter-sdk-v0.1.0...sprinter-sdk-v0.2.0)
(2024-09-23)


### Features

* implement tracing url resolver
([#46](#46))
([efd1be3](efd1be3)),
closes [#44](#44)
* react sdk context
([#48](#48))
([39dbe7e](39dbe7e)),
closes [#47](#47)
</details>

<details><summary>sprinter-react: 0.1.0</summary>

##
[0.1.0](sprinter-react-v0.0.1...sprinter-react-v0.1.0)
(2024-09-23)


### Features

* react sdk context
([#48](#48))
([39dbe7e](39dbe7e)),
closes [#47](#47)
</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>
@BeroBurny BeroBurny deleted the beroburny/react-context branch September 23, 2024 16:39
@github-actions github-actions bot mentioned this pull request Sep 23, 2024
BeroBurny pushed a commit that referenced this pull request Sep 23, 2024
🤖 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>
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.

React implementation for SDK

3 participants