Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions packages/assets-controllers/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Added

- Add `offhours` field to `TokenRwaData` and `RwaTokenData` types to support off-hours RWA trading windows ([#9792](https://github.com/MetaMask/core/pull/9792))
- `offhours.nextOpen`: ISO-8601 datetime when the next off-hours window opens
- `offhours.nextClose`: ISO-8601 datetime when the next off-hours window closes
- Field is only present when the asset's source reports off-hours tradability; absence means off-hours trading is not supported
- Add 0G (`16661`/`0x4115`) entries in `multicall.ts` and `codefi-v2.ts` ([#9760](https://github.com/MetaMask/core/pull/9760))

### Changed
Expand Down
41 changes: 41 additions & 0 deletions packages/assets-controllers/src/token-service.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2003,6 +2003,47 @@ describe('Token service', () => {
expect(result).toStrictEqual(sampleRwasResponse);
});

it('passes through offhours field when present in the response', async () => {
const responseWithOffhours = {
...sampleRwasResponse,
data: [
{
...sampleRwasResponse.data[0],
rwaData: {
...sampleRwasResponse.data[0].rwaData,
offhours: {
nextOpen: '2026-08-08T00:05:00Z',
nextClose: '2026-08-09T23:55:00Z',
},
},
},
],
};

nock(TOKEN_END_POINT_API)
.get('/v1/rwas?limit=100')
.reply(200, responseWithOffhours)
.persist();
Comment thread
satyajeetkolhapure marked this conversation as resolved.

const result = await fetchRwas();

expect(result.data[0].rwaData.offhours).toStrictEqual({
nextOpen: '2026-08-08T00:05:00Z',
nextClose: '2026-08-09T23:55:00Z',
});
});

it('returns rwaData without offhours field when asset does not support off-hours trading', async () => {
nock(TOKEN_END_POINT_API)
.get('/v1/rwas?limit=100')
.reply(200, sampleRwasResponse)
.persist();

const result = await fetchRwas();

expect(result.data[0].rwaData.offhours).toBeUndefined();
});

it('throws if the fetch fails', async () => {
nock(TOKEN_END_POINT_API).get('/v1/rwas?limit=100').reply(500);

Expand Down
8 changes: 8 additions & 0 deletions packages/assets-controllers/src/token-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -380,6 +380,10 @@ export type TokenRwaData = {
start?: string;
end?: string;
};
offhours?: {
nextOpen?: string;
nextClose?: string;
};
ticker?: string;
instrumentType?: string;
};
Expand All @@ -401,6 +405,10 @@ export type RwaTokenData = {
industry: string[];
market?: RwaMarket;
nextPause?: Record<string, unknown>;
offhours?: {
nextOpen?: string;
nextClose?: string;
};
sharesOutstanding?: number;
restrictedCountries?: string[];
updatedAt?: string;
Expand Down