Skip to content

Commit

Permalink
Added changeset
Browse files Browse the repository at this point in the history
  • Loading branch information
codebycarson committed Sep 3, 2024
1 parent 8d4e409 commit 3f33856
Show file tree
Hide file tree
Showing 7 changed files with 599 additions and 30 deletions.
6 changes: 6 additions & 0 deletions .changeset/healthy-icons-divide.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
'@slinks/blink-ui': patch
'@sei-js/actions': patch
---

Release updated versions
4 changes: 1 addition & 3 deletions packages/actions/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
"prebuild": "rimraf dist",
"build": "tsc --project tsconfig.json && yarn build:prettier",
"build:prettier": "prettier --write 'dist/**/*.js'",
"docs": "typedoc --out docs",
"test": "jest",
"lint": "eslint --ext .ts"
},
Expand All @@ -26,9 +25,8 @@
],
"repository": "[email protected]:sei-protocol/sei-js.git",
"license": "MIT",
"private": false,
"publishConfig": {
"access": "public"
"access": "restricted"
},
"dependencies": {
"@ethersproject/abstract-provider": "^5.7.0"
Expand Down
5 changes: 3 additions & 2 deletions packages/actions/src/__tests__/types.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,15 @@ describe('GetSeiActionResponse', () => {
label: 'Test Label',
title: 'Test Title',
description: 'Test Description',
transactionType: 'EVM',
links: {
actions: [
{
label: 'Test Action',
href: '/api/test-action',
chainType: 'EVM',
parameters: [
{
type: 'text',
name: 'param1',
label: 'Param 1',
required: true
Expand All @@ -26,6 +27,6 @@ describe('GetSeiActionResponse', () => {
};

expect(response).toHaveProperty('icon', 'https://example.com/icon.png');
expect(response.links.actions[0].chainType).toBe('EVM');
expect(response.links.transactionType).toBe('EVM');
});
});
2 changes: 1 addition & 1 deletion packages/actions/src/index.ts
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export { SeiActionsJSON, GetSeiActionResponse, SeiActionConfig, PostSeiActionRequest, PostSeiActionResponse } from './types';
export * from './types';
63 changes: 48 additions & 15 deletions packages/actions/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,26 +8,52 @@ export interface SeiActionsJSON {
}>;
}

// Define the type for the GET response for a given action
// Type for the GET response for a given action
export interface GetSeiActionResponse {
icon: string;
label: string;
title: string;
description: string;
icon: string; // URL pointing to an image describing the action.
label: string; // Text to be displayed on the button used to execute the action.
title: string; // The title of the action.
description: string; // A brief description of the action.
disabled?: boolean; // Optional flag to disable all buttons associated with the action.
transactionType: 'EVM' | 'COSMOS'; // The type of blockchain transaction to be executed.
links: {
actions: SeiActionConfig[];
actions: SeiActionConfig[]; // An array of SeiActionConfig objects defining the actions available.
};
error?: SeiActionError; // Error message intended to be displayed to the user.
}

// Define the type for individual actions
export interface SeiActionConfig {
label: string;
href: string;
chainType: 'EVM' | 'COSMOS';
parameters?: Array<{
name: string;
parameters?: (SeiActionParameter | SeiActionParameterSelectable)[];
}

export type SeiActionParameterType = 'text' | 'address' | 'email' | 'url' | 'number' | 'date' | 'datetime-local' | 'checkbox' | 'radio' | 'textarea' | 'select';

export type SeiActionParameter = {
name: string;
type: SeiActionParameterType;
label: string;
required?: boolean;
/** regular expression pattern to validate user input client side */
pattern?: string;
/** human-readable description of the `type` and/or `pattern`, represents a caption and error, if value doesn't match */
patternDescription?: string;
/** the minimum value allowed based on the `type` */
min?: string | number;
/** the maximum value allowed based on the `type` */
max?: string | number;
};

// Used if parameter is type 'select', 'radio', or 'checkbox'
export interface SeiActionParameterSelectable extends SeiActionParameter {
options: Array<{
/** displayed UI label of this selectable option */
label: string;
required?: boolean;
/** value of this selectable option */
value: string;
/** whether or not this option should be selected by default */
selected?: boolean;
}>;
}

Expand All @@ -37,8 +63,15 @@ export interface PostSeiActionRequest {
[key: string]: unknown;
}

// Define the type for the POST response for a given action
export interface PostSeiActionResponse {
transaction: TransactionRequest | never;
message?: string;
export interface SeiActionError {
/** non-fatal error message to be displayed to the user */
message: string;
}

export type SeiActionSuccessResponse = {
transaction: TransactionRequest | any;
message?: string;
};

// Define the type for the POST response for a given action
export type PostSeiActionResponse = SeiActionSuccessResponse | SeiActionError;
1 change: 0 additions & 1 deletion packages/blink-ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
"types": "dist/index.d.ts",
"author": "carson",
"license": "MIT",
"private": false,
"scripts": {
"prebuild": "rimraf dist",
"build": "rollup -c"
Expand Down
Loading

0 comments on commit 3f33856

Please sign in to comment.