Skip to content

Commit

Permalink
chore: export SingleSig payload and transaction types
Browse files Browse the repository at this point in the history
  • Loading branch information
brusherru committed Mar 26, 2024
1 parent 4eddc24 commit 9045dce
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 3 deletions.
2 changes: 1 addition & 1 deletion package.json
@@ -1,6 +1,6 @@
{
"name": "@spacemesh/sm-codec",
"version": "0.4.1",
"version": "0.5.0",
"description": "Spacemesh Transaction Codec library",
"main": "./lib/index.js",
"scripts": {
Expand Down
6 changes: 6 additions & 0 deletions src/index.ts
Expand Up @@ -8,3 +8,9 @@ export * from './codecs/compact';
export * from './codecs/signatures';
export { StdTemplates, StdPublicKeys } from './std';
export { default as SingleSigTemplate } from './std/singlesig';
export type {
SpawnPayload,
SpendPayload,
SpawnTransaction,
SpendTransaction,
} from './std/singlesig';
10 changes: 8 additions & 2 deletions src/std/singlesig.ts
@@ -1,9 +1,9 @@
import { Codec, Struct } from 'scale-ts';
import { Codec, CodecType, Struct } from 'scale-ts';
import { Compact64 } from '../codecs/compact';
import { Address, GasPrice, Nonce, PublicKey } from '../codecs/core';
import { SingleSig } from '../codecs/signatures';
import withTemplateAddress from '../codecs/withTemplateAddress';
import Transaction, { Payload } from '../transaction';
import Transaction, { Payload, TransactionData } from '../transaction';
import { bytesToHex } from '../utils/hex';
import { padAddress } from '../utils/padBytes';

Expand Down Expand Up @@ -32,6 +32,12 @@ const SpendPayload = Struct({
Arguments: SpendArguments,
});

export type SpawnPayload = CodecType<typeof SpawnPayload>;
export type SpendPayload = CodecType<typeof SpendPayload>;

export type SpawnTransaction = TransactionData<SpawnPayload>;
export type SpendTransaction = TransactionData<SpendPayload>;

// Template
const newT = <T extends Payload, S>(n: number, pc: Codec<T>, sig: Codec<S>) =>
new Transaction({
Expand Down

0 comments on commit 9045dce

Please sign in to comment.