-
Notifications
You must be signed in to change notification settings - Fork 43
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: burner wallet storage incompatibility with Node.js env (#156)
- Loading branch information
1 parent
fccb12d
commit 481b5fe
Showing
4 changed files
with
46 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
--- | ||
"@fuel-connectors/burner-wallet-connector": patch | ||
"@fuels/connectors": patch | ||
--- | ||
|
||
- [Add support for burner wallet config on default connectors](https://github.com/FuelLabs/fuel-connectors/commit/fb845c0cfdfccfda60637af8d405964e9efbdecb) | ||
- [Burner wallet storage not working on nodejs](https://github.com/FuelLabs/fuel-connectors/commit/bbf19a2f8b6faeafc5c99055fe2ce2beb2988400) | ||
- [Create in memory storage on burner wallet](https://github.com/FuelLabs/fuel-connectors/commit/242b24f84f4ac35dba9c1332cb46c80bac5f4766) | ||
|
||
Observation: Burner Wallet's Storage will not persist information between executions on Vercel or Node.js env. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import type { StorageAbstract } from 'fuels'; | ||
|
||
export class InMemoryStorage implements StorageAbstract { | ||
private storage: Map<string, string>; | ||
|
||
constructor() { | ||
this.storage = new Map<string, string>(); | ||
} | ||
|
||
async setItem(key: string, value: string): Promise<void> { | ||
this.storage.set(key, value); | ||
} | ||
|
||
async getItem(key: string): Promise<string | null> { | ||
const value = this.storage.get(key); | ||
return value !== undefined ? value : null; | ||
} | ||
|
||
async removeItem(key: string): Promise<void> { | ||
this.storage.delete(key); | ||
} | ||
|
||
async clear(): Promise<void> { | ||
this.storage.clear(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters