ReferenceAPI ReferenceRules
Create Rules
Create Rules.
Request
interface RulesCreateRequest {
action: 'add'
resource: '/rules'
details: {
rlid: string
name: string
resource: string
action: string
description: string
}
}Prop
Type
Response
interface RulesCreateResponse_success {
status: 'success'
error_code?: '-1' | '-2' | '-3' | '-4' | '-5' | '-6' | '-7' | '-8' | '-9' | '-10' | '-11' | '-12' | '-13' | undefined
message?: string | undefined
details: {
rlid: string
name: string
description: string | undefined
action: string
resource: string
created_at: string
}
metadata: unknown
}Prop
Type
interface RulesCreateResponse_pending {
status: 'pending'
error_code?: '-1' | '-2' | '-3' | '-4' | '-5' | '-6' | '-7' | '-8' | '-9' | '-10' | '-11' | '-12' | '-13' | undefined
message?: string | undefined
details: {
proposal_id: string
}
}Prop
Type
Example
import { resourceSchema } from '@blockstream/ecs-js-sdk'
import { broadcastRequest } from './broadcaster'
const response = await broadcastRequest<
typeof resourceSchema.shape.rules.shape.create
>(
{
action: 'add',
resource: '/rules',
details: {
// TODO: fill in required fields
},
},
blockstream,
)