Skip to content

Map enriched event types to the child objects they will contain #73

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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
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
4 changes: 4 additions & 0 deletions lib/firefly.ts
Original file line number Diff line number Diff line change
Expand Up @@ -341,6 +341,10 @@ export default class FireFly extends HttpBase {
return this.getOne<FireFlyTokenPoolResponse>(`/tokens/pools/${nameOrId}`, options);
}

async deleteTokenPool(nameOrId: string, options?: FireFlyDeleteOptions) {
await this.deleteOne(`/tokens/pools/${nameOrId}`, options);
}

mintTokens(transfer: FireFlyTokenMintRequest, options?: FireFlyCreateOptions) {
return this.createOne<FireFlyTokenTransferResponse>('/tokens/mint', transfer, options);
}
Expand Down
68 changes: 52 additions & 16 deletions lib/interfaces.ts
Original file line number Diff line number Diff line change
Expand Up @@ -146,27 +146,63 @@ export interface FireFlyEphemeralSubscription extends FireFlySubscriptionBase {
namespace: string;
}

export interface FireFlyEnrichedEvent extends FireFlyEventResponse {
blockchainEvent?: FireFlyBlockchainEventResponse;
contractAPI?: FireFlyContractAPIResponse;
contractInterface?: FireFlyContractInterfaceResponse;
datatype?: FireFlyDatatypeResponse;
identity?: FireFlyIdentityResponse;
message?: FireFlyMessageResponse;
tokenApproval?: FireFlyTokenApprovalResponse;
tokenPool?: FireFlyTokenPoolResponse;
tokenTransfer?: FireFlyTokenTransferResponse;
transaction?: FireFlyTransactionResponse;
operation?: FireFlyOperationResponse;
}

export interface FireFlyEventDelivery extends FireFlyEnrichedEvent {
export type FireFlyEnrichedEvent = FireFlyEventResponse &
(
| {
type: 'transaction_submitted';
transaction: FireFlyTransactionResponse;
}
| {
type: 'message_confirmed' | 'message_rejected';
message: FireFlyMessageResponse;
}
| {
type: 'identity_confirmed' | 'identity_updated';
identity: FireFlyIdentityResponse;
}
| {
type: 'token_pool_confirmed';
tokenPool: FireFlyTokenPoolResponse;
}
| {
type: 'token_transfer_confirmed';
tokenTransfer: FireFlyTokenTransferResponse;
}
| {
type: 'token_approval_confirmed';
tokenApproval: FireFlyTokenApprovalResponse;
}
| {
type: 'contract_interface_confirmed';
contractInterface: FireFlyContractInterfaceResponse;
}
| {
type: 'contract_api_confirmed';
contractAPI: FireFlyContractAPIResponse;
}
| {
type: 'blockchain_event_received';
blockchainEvent: FireFlyBlockchainEventResponse;
}
| {
type:
| 'token_pool_op_failed'
| 'token_approval_op_failed'
| 'blockchain_invoke_op_succeeded'
| 'blockchain_invoke_op_failed'
| 'blockchain_contract_deploy_op_succeeded'
| 'blockchain_contract_deploy_op_failed';
operation: FireFlyOperationResponse;
}
);

export type FireFlyEventDelivery = FireFlyEnrichedEvent & {
subscription: {
id: string;
name: string;
namespace: string;
};
}
};

// Datatypes

Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@hyperledger/firefly-sdk",
"version": "1.2.10",
"version": "1.2.11",
"description": "Client SDK for Hyperledger FireFly",
"main": "dist/index.js",
"types": "dist/index.d.ts",
Expand Down Expand Up @@ -45,4 +45,4 @@
"form-data": "^4.0.0",
"ws": "^8.5.0"
}
}
}