Skip to content

Commit

Permalink
feat: add optional dependencies option on transaction sign and broadcast
Browse files Browse the repository at this point in the history
  • Loading branch information
Justkant committed Aug 20, 2024
1 parent 4a0b572 commit 7b4b793
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 16 deletions.
5 changes: 5 additions & 0 deletions .changeset/fair-mangos-suffer.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@ledgerhq/wallet-api-core": minor
---

feat: add optional dependencies option on transaction sign and broadcast
40 changes: 24 additions & 16 deletions apps/docs/pages/docs/discover/wallet-api/appendix/transaction.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -56,60 +56,68 @@ There are also raw representations of transactions, often used when serializing
### TransactionSign Type

#### Parameters:

- `accountId` (string, required): The ID of the account where the transaction will be made.
- `rawTransaction` (RawTransaction, required): The transaction object in a raw, serialized format specific to the cryptocurrency family.
- `options` (object, optional):
- `hwAppId` (string, optional): A hardware wallet application ID.
- `dependencies` (string[], optional): A list of hardware wallet application ID.
- `meta` (object, optional): Metadata for the transaction in the format `{ [key: string]: unknown }`.

#### Results:

- `signedTransactionHex` (string): The hexadecimal string representation of the signed transaction.

#### Type Definition:

```typescript
type TransactionSign = {
params: {
accountId: string,
rawTransaction: RawTransaction,
accountId: string;
rawTransaction: RawTransaction;
options?: {
hwAppId?: string
},
meta?: Record<string, unknown>
},
hwAppId?: string;
dependencies?: string[];
};
meta?: Record<string, unknown>;
};
result: {
signedTransactionHex: string
}
signedTransactionHex: string;
};
};
```

### TransactionSignAndBroadcast Type

#### Parameters:

- `accountId` (string, required): The ID of the account where the transaction will be made.
- `rawTransaction` (RawTransaction, required): The transaction object in a raw, serialized format specific to the cryptocurrency family.
- `options` (object, optional):
- `hwAppId` (string, optional): A hardware wallet application ID.
- `dependencies` (string[], optional): A list of hardware wallet application ID.
- `meta` (object, optional): Metadata for the transaction in the format `{ [key: string]: unknown }`.

#### Results:

- `transactionHash` (string): The hash of the transaction once it's been broadcasted to the network.

#### Type Definition:

```typescript
type TransactionSignAndBroadcast = {
params: {
accountId: string,
rawTransaction: RawTransaction,
accountId: string;
rawTransaction: RawTransaction;
options?: {
hwAppId?: string
},
meta?: Record<string, unknown>
},
hwAppId?: string;
dependencies?: string[];
};
meta?: Record<string, unknown>;
};
result: {
transactionHash: string
}
transactionHash: string;
};
};
```

Expand Down
1 change: 1 addition & 0 deletions packages/core/src/spec/types/TransactionSign.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { schemaRawTransaction } from "../../families";

const schemaTransactionOptions = z.object({
hwAppId: z.string().optional(),
dependencies: z.array(z.string()).optional(),
});

const schemaTransactionSignParams = z.object({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { schemaRawTransaction } from "../../families";

const schemaTransactionOptions = z.object({
hwAppId: z.string().optional(),
dependencies: z.array(z.string()).optional(),
});

const schemaTransactionSignAndBroadcastParams = z.object({
Expand Down

0 comments on commit 7b4b793

Please sign in to comment.