Skip to content

Commit

Permalink
Merge pull request o1-labs#1853 from rpanic/fix/state-fetch-token
Browse files Browse the repository at this point in the history
Fixed state.fetch() behaviour in regards to custom token contracts
  • Loading branch information
Trivo25 authored Oct 10, 2024
2 parents 59a6c58 + d75cf6c commit 0f8ff81
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
5 changes: 3 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,14 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm

### Added

- Added `verifyEthers` method to verify Ethereum signatures using the EIP-191 message hashing standard https://github.com/o1-labs/o1js/pull/1815
- Added `verifyEthers` method to verify Ethereum signatures using the EIP-191 message hashing standard. https://github.com/o1-labs/o1js/pull/1815
- Added `fromEthers` method for parsing and converting Ethereum public keys into `ForeignCurve` points, supporting both compressed and uncompressed formats.
- Added `fromHex` method for converting hexadecimal strings into `ForeignCurve` points.

### Fixes

- Fix incorrect behavior of optional proving for zkPrograms where `myProgram.setProofsEnabled(false)` wouldn't work when called before `myProgram.compile()` https://github.com/o1-labs/o1js/pull/1827
- Fix incorrect behavior of optional proving for zkPrograms where `myProgram.setProofsEnabled(false)` wouldn't work when called before `myProgram.compile()`. https://github.com/o1-labs/o1js/pull/1827
- Fix incorrect behavior of `state.fetch()` for custom token contracts. [@rpanic](https://github.com/rpanic) https://github.com/o1-labs/o1js/pull/1853

## [1.7.0](https://github.com/o1-labs/o1js/compare/d6abf1d97...5006e4f) - 2024-09-04

Expand Down
5 changes: 3 additions & 2 deletions src/lib/mina/state.ts
Original file line number Diff line number Diff line change
Expand Up @@ -362,13 +362,14 @@ function createState<T>(defaultValue?: T): InternalStateType<T> {

let layout = getLayoutPosition(this._contract);
let address: PublicKey = this._contract.instance.address;
let tokenId: Field = this._contract.instance.tokenId;
let account: Account | undefined;
if (networkConfig.minaEndpoint === '') {
account = Mina.getAccount(address, TokenId.default);
account = Mina.getAccount(address, tokenId);
} else {
({ account } = await fetchAccount({
publicKey: address,
tokenId: TokenId.toBase58(TokenId.default),
tokenId: TokenId.toBase58(tokenId),
}));
}
if (account === undefined) return undefined;
Expand Down

0 comments on commit 0f8ff81

Please sign in to comment.