Skip to content

Commit

Permalink
rename delayed-nft to delayed-asset
Browse files Browse the repository at this point in the history
  • Loading branch information
ecioppettini committed Dec 29, 2023
1 parent 5a1323a commit f2ed82e
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 20 deletions.
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
import type {
CdeCardanoAssetUtxoDatum,
ChainDataExtensionCardanoDelayedNft,
ChainDataExtensionCardanoDelayedAsset,
ChainDataExtensionDatum,
} from '@paima/sm';
import { ChainDataExtensionDatumType, DEFAULT_FUNNEL_TIMEOUT, timeout } from '@paima/utils';
import { Routes, query } from '@dcspark/carp-client/client/src';
import { AssetUtxosResponse } from '@dcspark/carp-client/shared/models/AssetUtxos';
import type { AssetUtxosResponse } from '@dcspark/carp-client/shared/models/AssetUtxos';

export default async function getCdeData(
url: string,
extension: ChainDataExtensionCardanoDelayedNft,
extension: ChainDataExtensionCardanoDelayedAsset,
fromAbsoluteSlot: number,
toAbsoluteSlot: number,
getBlockNumber: (slot: number) => number
Expand All @@ -28,7 +28,7 @@ export default async function getCdeData(

function eventToCdeDatum(
event: AssetUtxosResponse[0],
extension: ChainDataExtensionCardanoDelayedNft,
extension: ChainDataExtensionCardanoDelayedAsset,
blockNumber: number
): CdeCardanoAssetUtxoDatum {
return {
Expand Down
8 changes: 4 additions & 4 deletions packages/engine/paima-funnel/src/funnels/carp/funnel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import type { FunnelSharedData } from '../BaseFunnel.js';
import type { PoolClient } from 'pg';
import type { ChainFunnel, ReadPresyncDataFrom } from '@paima/runtime';
import getCdePoolData from '../../cde/cardanoPool.js';
import getCdeDelayedNft from '../../cde/delayedNft.js';
import getCdeDelayedAsset from '../../cde/delayedAsset.js';
import { query } from '@dcspark/carp-client/client/src/index';
import { Routes } from '@dcspark/carp-client/shared/routes';
import { FUNNEL_PRESYNC_FINISHED } from '@paima/utils/src/constants';
Expand Down Expand Up @@ -155,7 +155,7 @@ export class CarpFunnel extends BaseFunnel implements ChainFunnel {
}

if (extension.cdeType === ChainDataExtensionType.CardanoAssetUtxo) {
const data = getCdeDelayedNft(
const data = getCdeDelayedAsset(
this.carpUrl,
extension,
arg.from,
Expand Down Expand Up @@ -309,15 +309,15 @@ async function readDataInternal(

return poolData;
case ChainDataExtensionType.CardanoAssetUtxo:
const delayedNftData = getCdeDelayedNft(
const delayedAssetData = getCdeDelayedAsset(
carpUrl,
extension,
min,
Math.min(max, extension.stopSlot || max),
mapSlotToBlockNumber
);

return delayedNftData;
return delayedAssetData;
default:
return Promise.resolve([]);
}
Expand Down
8 changes: 4 additions & 4 deletions packages/engine/paima-runtime/src/cde-config/loading.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ import type {
import {
CdeBaseConfig,
CdeEntryTypeName,
ChainDataExtensionCardanoDelayedNftConfig,
ChainDataExtensionCardanoDelayedAssetConfig,
ChainDataExtensionCardanoDelegationConfig,
ChainDataExtensionErc20Config,
ChainDataExtensionErc20DepositConfig,
Expand Down Expand Up @@ -90,8 +90,8 @@ export function parseCdeConfigFile(configFileData: string): Static<typeof CdeCon
return checkOrError(entry.name, ChainDataExtensionErc6551RegistryConfig, entry);
case CdeEntryTypeName.CardanoDelegation:
return checkOrError(entry.name, ChainDataExtensionCardanoDelegationConfig, entry);
case CdeEntryTypeName.CardanoDelayedNft:
return checkOrError(entry.name, ChainDataExtensionCardanoDelayedNftConfig, entry);
case CdeEntryTypeName.CardanoDelayedAsset:
return checkOrError(entry.name, ChainDataExtensionCardanoDelayedAssetConfig, entry);
default:
assertNever(entry.type);
}
Expand Down Expand Up @@ -206,7 +206,7 @@ async function instantiateExtension(
hash: hashConfig(config),
cdeType: ChainDataExtensionType.CardanoPool,
};
case CdeEntryTypeName.CardanoDelayedNft:
case CdeEntryTypeName.CardanoDelayedAsset:
return {
...config,
cdeId: index,
Expand Down
2 changes: 1 addition & 1 deletion packages/engine/paima-sm/src/cde-processing.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import processErc20DepositDatum from './cde-erc20-deposit.js';
import processErc6551RegistryDatum from './cde-erc6551-registry.js';
import processGenericDatum from './cde-generic.js';
import processCardanoDelegationDatum from './cde-cardano-pool.js';
import processCardanoAssetUtxoDatum from './cde-cardano-delayed-nft.js';
import processCardanoAssetUtxoDatum from './cde-cardano-delayed-asset.js';
import assertNever from 'assert-never';
import type { SQLUpdate } from '@paima/db';

Expand Down
14 changes: 7 additions & 7 deletions packages/engine/paima-sm/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ export enum CdeEntryTypeName {
ERC721 = 'erc721',
ERC6551Registry = 'erc6551-registry',
CardanoDelegation = 'cardano-stake-delegation',
CardanoDelayedNft = 'cardano-delayed-nft',
CardanoDelayedAsset = 'cardano-delayed-asset',
}

const EvmAddress = Type.Transform(Type.RegExp('0x[0-9a-fA-F]{40}'))
Expand Down Expand Up @@ -279,17 +279,17 @@ export type ChainDataExtensionCardanoDelegation = ChainDataExtensionBase &
cdeType: ChainDataExtensionType.CardanoPool;
};

export const ChainDataExtensionCardanoDelayedNftConfig = Type.Object({
type: Type.Literal(CdeEntryTypeName.CardanoDelayedNft),
export const ChainDataExtensionCardanoDelayedAssetConfig = Type.Object({
type: Type.Literal(CdeEntryTypeName.CardanoDelayedAsset),
fingerprints: Type.Optional(Type.Array(Type.String())),
policyIds: Type.Optional(Type.Array(Type.String())),
startSlot: Type.Number(),
stopSlot: Type.Optional(Type.Number()),
name: Type.String(),
});

export type ChainDataExtensionCardanoDelayedNft = ChainDataExtensionBase &
Static<typeof ChainDataExtensionCardanoDelayedNftConfig> & {
export type ChainDataExtensionCardanoDelayedAsset = ChainDataExtensionBase &
Static<typeof ChainDataExtensionCardanoDelayedAssetConfig> & {
cdeType: ChainDataExtensionType.CardanoAssetUtxo;
};

Expand All @@ -302,7 +302,7 @@ export const CdeConfig = Type.Object({
ChainDataExtensionGenericConfig,
ChainDataExtensionErc6551RegistryConfig,
ChainDataExtensionCardanoDelegationConfig,
ChainDataExtensionCardanoDelayedNftConfig,
ChainDataExtensionCardanoDelayedAssetConfig,
])
),
});
Expand All @@ -328,7 +328,7 @@ export type ChainDataExtension =
| ChainDataExtensionGeneric
| ChainDataExtensionErc6551Registry
| ChainDataExtensionCardanoDelegation
| ChainDataExtensionCardanoDelayedNft;
| ChainDataExtensionCardanoDelayedAsset;

export type GameStateTransitionFunctionRouter = (
blockHeight: number
Expand Down

0 comments on commit f2ed82e

Please sign in to comment.