Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cardano transfer and mint and burn docs #32

Merged
merged 2 commits into from
Mar 20, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ extensions:
startSlot: 32815320
stopSlot: 32815924
scheduledPrefix: cd
network: CardanoNetworkConfigEntryName
```

### Meaning
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ extensions:
- "919d4c2c9455016289341b1bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb"
startSlot: 22505578
stopSlot: 32815924
network: CardanoNetworkConfigEntryName
```

### Meaning
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@

# Cardano Transfer {#transfer}

Keeps track of the entire (between the indexed slots) transaction history of a
particular address.

### Example

```yaml
extensions:
- name: "CardanoTransfer"
type: cardano-transfer
credential: addr_test1qp27ms6du9e2fga6njk9ruzprp7gg3uddrnc3htv7mct8kwrwdlnpt07ycmdqyuw7lft338dt33tmr6xdwnn8ezsudpquved20
SebastienGllmt marked this conversation as resolved.
Show resolved Hide resolved
startSlot: 12472120
stopSlot: 12500000
scheduledPrefix: ct
network: CardanoNetworkConfigEntryName
```

### Meaning

- `startSlot` is required and means that only transactions that happen after that slot (exclusive) will be considered.
- `stopSlot` is optional, and it stops the indexing at that point.
- `credential` is the address to track. This can be a bech32 address, or a hex encoded credential.

### Paima Concise format

The scheduled input for each event is of the following form.

```
cardanoTransfer = ct|txId|metadata|inputCredentials|outputs
```

It can be parsed with a rule of the form:

```ts
const cardanoTransfer: ParserRecord<CardanoTransfer> = {
txId: PaimaParser.NCharsParser(0, 64),
metadata: PaimaParser.OptionalParser(null, PaimaParser.RegexParser(/[a-f0-9]*/)),
inputCredentials: PaimaParser.ArrayParser({
item: PaimaParser.RegexParser(/[a-f0-9]*/),
}),
outputs: (keyName: string, input: string) => {
return JSON.parse(input);
},
};

interface CardanoTransfer {
txId: string;
metadata: string | null;
inputCredentials: string[];
outputs: {
asset: { policyId: string; assetName: string } | null;
amount: string;
address: string;
}[];
}
```

- The metadata field is in its binary form, but hex encoded.
- The entries in `inputCredentials` are also hex encoded. Each one is the binary
representation of the payment key (64 characters or 32 bytes).
- `outputs` preserves the same order as in the binary transaction. The `asset`
will be `null` when the amount is in lovelace.

Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
# Cardano Mint and Burn {#mint-burn}

### Example

```yaml
extensions:
- name: "CARDANO-MINT-BURN"
type: cardano-mint-burn
policyIds:
- "0fc891fb7368d3b7c7b88815c203fda0d6862b0f1d797222672e91fe"
- "0fc891fb7368d3b7c7b88815c203fda0d6862b0f1d797222672e91ff"
startSlot: 722300
stopSlot: 733216
scheduledPrefix: cmb
network: CardanoNetworkConfigEntryName
```

### Meaning

- `startSlot` is required and means that only mints events after that slot (exclusive) will be considered.
- `stopSlot` is optional, and it stops the indexing at that point.
- `policyIds` is an array with the collections to index.

### Paima Concise format

The scheduled input for each event is of the following form.

```
cardanoMint = cmb|txId|metadata|assets
```

It can be parsed with a rule of the form:

```ts
const cardanoMint: ParserRecord<CardanoMint> = {
txId: PaimaParser.NCharsParser(0, 64),
metadata: PaimaParser.OptionalParser(null, PaimaParser.RegexParser(/[a-f0-9]*/)),
assets: (keyName: string, input: string) => {
return JSON.parse(input);
},
};

export interface CardanoMint {
txId: string;
metadata: string | null;
assets: { asset: { policyId: string; assetName: string }; amount: string };
}
```

- The `metadata` field is hex encoded (if any), and it's the metadata in binary
form.
- The `assets` field has the minted or burned assets. The difference between a
mint and a burn is in the sign of `amount` when interpreted as a number.
Loading