|
1 | 1 | import { BaseProjectionEvent } from '@cardano-sdk/projection'; |
2 | 2 | import { Cardano, ChainSyncEventType } from '@cardano-sdk/core'; |
| 3 | +import { ChainSyncDataSet, chainSyncData } from '@cardano-sdk/util-dev'; |
3 | 4 | import { HandleEntity } from '../../../src'; |
4 | | -import { ProjectorContext, createProjectorContext, createStubProjectionSource } from '../util'; |
| 5 | +import { ProjectorContext, createProjectorContext, createStubProjectionSource, filterAssets } from '../util'; |
5 | 6 | import { QueryRunner } from 'typeorm'; |
6 | | -import { createMultiTxProjectionSource, entities, mapAndStore, projectTilFirst } from './util'; |
| 7 | +import { createMultiTxProjectionSource, entities, mapAndStore, project$, projectTilFirst } from './util'; |
7 | 8 | import { firstValueFrom } from 'rxjs'; |
8 | 9 | import { initializeDataSource } from '../../util'; |
9 | 10 |
|
@@ -156,6 +157,19 @@ describe('storeHandles', () => { |
156 | 157 | expect(handleInDbAfterTransferRollback?.cardanoAddress).toEqual(originalOwnerAddress); |
157 | 158 | }); |
158 | 159 |
|
| 160 | + it('upgrading handle to cip68 sets owner address to user nft (222) holder', async () => { |
| 161 | + const eventsWithCip68Handle = filterAssets(chainSyncData(ChainSyncDataSet.Cip68HandleProblem), [ |
| 162 | + Cardano.AssetId('f0ff48bbb7bbe9d59a40f1ce90e9e9d0ff5002ec48f232b49ca0fb9a000de14073696c766572666f78'), |
| 163 | + Cardano.AssetId('f0ff48bbb7bbe9d59a40f1ce90e9e9d0ff5002ec48f232b49ca0fb9a000643b073696c766572666f78') |
| 164 | + ]); |
| 165 | + const evt = await firstValueFrom(project$(context, eventsWithCip68Handle.cardanoNode)()); |
| 166 | + const silverfoxHandle = evt.handles.find(({ handle }) => handle === 'silverfox'); |
| 167 | + expect(silverfoxHandle).toBeTruthy(); |
| 168 | + expect(silverfoxHandle?.latestOwnerAddress).toBe( |
| 169 | + 'addr1qx9t73ew53xtgt5tlruq8gr3grwca0urr0z9j2hre0gnlj0xe7yuukw0jrjaa2zvxnvga0zvycthvuf4l28yev95trdqq8q6rn' |
| 170 | + ); |
| 171 | + }); |
| 172 | + |
159 | 173 | describe('multiple transactions in 1 block', () => { |
160 | 174 | const maryAddress = Cardano.PaymentAddress( |
161 | 175 | 'addr_test1qz690wvatwqgzt5u85hfzjxa8qqzthqwtp7xq8t3wh6ttc98hqtvlesvrpvln3srklcvhu2r9z22fdhaxvh2m2pg3nuq0n8gf2' |
|
0 commit comments