diff --git a/frontend/declarations/backend.did.d.ts b/frontend/declarations/backend.did.d.ts index 5e191da..8652e50 100644 --- a/frontend/declarations/backend.did.d.ts +++ b/frontend/declarations/backend.did.d.ts @@ -264,6 +264,7 @@ export interface _SERVICE { 'list_logs' : ActorMethod<[LogsFilterRequest], ListLogsResponse>, 'promote_user_to_admin' : ActorMethod<[UserId], ApiEmptyResult>, 'query_blocks' : ActorMethod<[GetBlocksArgs], QueryBlocksResult>, + 'set_mutual_tls_certificate' : ActorMethod<[string], ApiEmptyResult>, 'update_akt_balance' : ActorMethod<[bigint], ApiFloatResult>, 'update_deployment_state' : ActorMethod< [string, DeploymentState], diff --git a/frontend/declarations/backend.did.js b/frontend/declarations/backend.did.js index 146a93b..b7ccf10 100644 --- a/frontend/declarations/backend.did.js +++ b/frontend/declarations/backend.did.js @@ -276,6 +276,7 @@ export const idlFactory = ({ IDL }) => { [QueryBlocksResult], ['composite_query'], ), + 'set_mutual_tls_certificate' : IDL.Func([IDL.Text], [ApiEmptyResult], []), 'update_akt_balance' : IDL.Func([IDL.Nat64], [ApiFloatResult], []), 'update_deployment_state' : IDL.Func( [IDL.Text, DeploymentState], diff --git a/src/backend/frontend/declarations/backend.did.d.ts b/src/backend/frontend/declarations/backend.did.d.ts deleted file mode 100644 index 8652e50..0000000 --- a/src/backend/frontend/declarations/backend.did.d.ts +++ /dev/null @@ -1,286 +0,0 @@ -import type { Principal } from '@dfinity/principal'; -import type { ActorMethod } from '@dfinity/agent'; -import type { IDL } from '@dfinity/candid'; - -export interface Account { - 'owner' : Principal, - 'subaccount' : [] | [SubAccount], -} -export interface AccountBalanceArgs { 'account' : AccountIdentifier } -export type AccountIdentifier = Uint8Array | number[]; -export type ApiEmptyResult = { 'Ok' : null } | - { 'Err' : ApiError }; -export interface ApiError { 'code' : number, 'message' : string } -export type ApiFloatResult = { 'Ok' : number } | - { 'Err' : ApiError }; -export type ApiNatResult = { 'Ok' : bigint } | - { 'Err' : ApiError }; -export type ApiStringResult = { 'Ok' : string } | - { 'Err' : ApiError }; -export interface ArchivedBlocksRange { - 'callback' : QueryArchiveFn, - 'start' : BlockIndex, - 'length' : bigint, -} -export interface Block { - 'transaction' : Transaction, - 'timestamp' : TimeStamp, - 'parent_hash' : [] | [Uint8Array | number[]], -} -export type BlockIndex = bigint; -export interface BlockRange { 'blocks' : Array } -export interface CanisterOutputCertifiedMessages { - 'messages' : Array, - 'cert' : Uint8Array | number[], - 'tree' : Uint8Array | number[], - 'is_end_of_queue' : boolean, -} -export interface CanisterOutputMessage { - 'key' : string, - 'content' : Uint8Array | number[], - 'client_key' : ClientKey, -} -export interface CanisterWsCloseArguments { 'client_key' : ClientKey } -export type CanisterWsCloseResult = { 'Ok' : null } | - { 'Err' : string }; -export interface CanisterWsGetMessagesArguments { 'nonce' : bigint } -export type CanisterWsGetMessagesResult = { - 'Ok' : CanisterOutputCertifiedMessages - } | - { 'Err' : string }; -export interface CanisterWsMessageArguments { 'msg' : WebsocketMessage } -export type CanisterWsMessageResult = { 'Ok' : null } | - { 'Err' : string }; -export interface CanisterWsOpenArguments { - 'gateway_principal' : GatewayPrincipal, - 'client_nonce' : bigint, -} -export type CanisterWsOpenResult = { 'Ok' : null } | - { 'Err' : string }; -export interface ClientKey { - 'client_principal' : ClientPrincipal, - 'client_nonce' : bigint, -} -export type ClientPrincipal = Principal; -export type CpuSize = { 'Large' : null } | - { 'Small' : null } | - { 'Medium' : null }; -export type CreateDeploymentResult = { 'Ok' : DeploymentId } | - { 'Err' : ApiError }; -export type CreateUserResult = { 'Ok' : UserId } | - { 'Err' : ApiError }; -export interface Deployment { - 'user_id' : UserId, - 'icp_price' : number, - 'state_history' : Array<[TimestampNs, DeploymentState]>, - 'params' : DeploymentParams, -} -export type DeploymentId = string; -export interface DeploymentParams { - 'cpu' : CpuSize, - 'memory' : MemorySize, - 'storage' : StorageSize, - 'name' : string, - 'volume_mount' : [] | [string], - 'command' : Array, - 'env_vars' : Array<[string, string]>, - 'image' : string, - 'ports' : Array< - { - 'container_port' : number, - 'domain' : [] | [string], - 'host_port' : number, - } - >, -} -export type DeploymentState = { 'FailedOnClient' : { 'reason' : string } } | - { 'Initialized' : null } | - { - 'DeploymentCreated' : { - 'manifest_sorted_json' : string, - 'dseq' : bigint, - 'tx_hash' : string, - } - } | - { 'Closed' : null } | - { 'Active' : null } | - { 'LeaseCreated' : { 'provider_url' : string, 'tx_hash' : string } } | - { 'FailedOnCanister' : { 'reason' : string } }; -export interface DeploymentUpdateWsMessage { - 'id' : string, - 'update' : DeploymentState, -} -export type GatewayPrincipal = Principal; -export interface GetBlocksArgs { 'start' : BlockIndex, 'length' : bigint } -export type GetDeploymentResult = { - 'Ok' : { 'id' : DeploymentId, 'deployment' : Deployment } - } | - { 'Err' : ApiError }; -export type GetDeploymentsResult = { - 'Ok' : Array<{ 'id' : DeploymentId, 'deployment' : Deployment }> - } | - { 'Err' : ApiError }; -export type GetUserResult = { 'Ok' : User } | - { 'Err' : ApiError }; -export type ListLogsResponse = { 'Ok' : { 'logs' : Array } } | - { 'Err' : ApiError }; -export interface LogEntry { - 'context' : [] | [string], - 'date_time' : string, - 'level' : LogLevel, - 'message' : string, -} -export type LogLevel = { 'info' : null } | - { 'warn' : null } | - { 'error' : null }; -export interface LogsFilterRequest { - 'context_contains_any' : [] | [Array], - 'level' : [] | [LogLevel], - 'message_contains_any' : [] | [Array], - 'after_timestamp_ms' : [] | [bigint], - 'before_timestamp_ms' : [] | [bigint], -} -export type Memo = bigint; -export type MemorySize = { 'Large' : null } | - { 'Small' : null } | - { 'Medium' : null }; -export type Operation = { - 'Approve' : { - 'fee' : Tokens, - 'from' : AccountIdentifier, - 'allowance_e8s' : bigint, - 'allowance' : Tokens, - 'expires_at' : [] | [TimeStamp], - 'spender' : AccountIdentifier, - } - } | - { - 'Burn' : { - 'from' : AccountIdentifier, - 'amount' : Tokens, - 'spender' : [] | [AccountIdentifier], - } - } | - { 'Mint' : { 'to' : AccountIdentifier, 'amount' : Tokens } } | - { - 'Transfer' : { - 'to' : AccountIdentifier, - 'fee' : Tokens, - 'from' : AccountIdentifier, - 'amount' : Tokens, - } - } | - { - 'TransferFrom' : { - 'to' : AccountIdentifier, - 'fee' : Tokens, - 'from' : AccountIdentifier, - 'amount' : Tokens, - 'spender' : AccountIdentifier, - } - }; -export type QueryArchiveError = { - 'BadFirstBlockIndex' : { - 'requested_index' : BlockIndex, - 'first_valid_index' : BlockIndex, - } - } | - { 'Other' : { 'error_message' : string, 'error_code' : bigint } }; -export type QueryArchiveFn = ActorMethod<[GetBlocksArgs], QueryArchiveResult>; -export type QueryArchiveResult = { 'Ok' : BlockRange } | - { 'Err' : QueryArchiveError }; -export interface QueryBlocksResponse { - 'certificate' : [] | [Uint8Array | number[]], - 'blocks' : Array, - 'chain_length' : bigint, - 'first_block_index' : BlockIndex, - 'archived_blocks' : Array, -} -export type QueryBlocksResult = { 'Ok' : QueryBlocksResponse } | - { 'Err' : ApiError }; -export type StorageSize = { 'Large' : null } | - { 'Small' : null } | - { 'Medium' : null }; -export type SubAccount = Uint8Array | number[]; -export interface TimeStamp { 'timestamp_nanos' : bigint } -export type TimestampNs = bigint; -export interface Tokens { 'e8s' : bigint } -export interface Transaction { - 'memo' : Memo, - 'icrc1_memo' : [] | [Uint8Array | number[]], - 'operation' : [] | [Operation], - 'created_at_time' : TimeStamp, -} -export interface TransferArgs { - 'to' : AccountIdentifier, - 'fee' : Tokens, - 'memo' : Memo, - 'from_subaccount' : [] | [SubAccount], - 'created_at_time' : [] | [TimeStamp], - 'amount' : Tokens, -} -export type TransferError = { - 'TxTooOld' : { 'allowed_window_nanos' : bigint } - } | - { 'BadFee' : { 'expected_fee' : Tokens } } | - { 'TxDuplicate' : { 'duplicate_of' : BlockIndex } } | - { 'TxCreatedInFuture' : null } | - { 'InsufficientFunds' : { 'balance' : Tokens } }; -export interface TransferFee { 'transfer_fee' : Tokens } -export type TransferFeeArg = {}; -export type TransferResult = { 'Ok' : BlockIndex } | - { 'Err' : TransferError }; -export interface User { - 'akt_balance' : number, - 'payments' : BigUint64Array | bigint[], - 'role' : UserRole, - 'created_at' : TimestampNs, -} -export type UserId = Principal; -export type UserRole = { 'Admin' : null } | - { 'Deployer' : null }; -export interface WebsocketMessage { - 'sequence_num' : bigint, - 'content' : Uint8Array | number[], - 'client_key' : ClientKey, - 'timestamp' : bigint, - 'is_service_message' : boolean, -} -export interface _SERVICE { - 'address' : ActorMethod<[], ApiStringResult>, - 'balance' : ActorMethod<[], ApiNatResult>, - 'check_tx' : ActorMethod<[string], ApiEmptyResult>, - 'close_deployment' : ActorMethod<[string], ApiEmptyResult>, - 'create_certificate' : ActorMethod<[string, string], ApiStringResult>, - 'create_deployment' : ActorMethod<[DeploymentParams], CreateDeploymentResult>, - 'create_test_deployment' : ActorMethod<[], CreateDeploymentResult>, - 'create_user' : ActorMethod<[], CreateUserResult>, - 'deposit_deployment' : ActorMethod<[string, bigint], ApiEmptyResult>, - 'get_deployment' : ActorMethod<[string], GetDeploymentResult>, - 'get_deployment_icp_price' : ActorMethod<[], ApiFloatResult>, - 'get_deployments' : ActorMethod<[], GetDeploymentsResult>, - 'get_my_user' : ActorMethod<[], GetUserResult>, - 'get_user' : ActorMethod<[Principal], GetUserResult>, - 'list_logs' : ActorMethod<[LogsFilterRequest], ListLogsResponse>, - 'promote_user_to_admin' : ActorMethod<[UserId], ApiEmptyResult>, - 'query_blocks' : ActorMethod<[GetBlocksArgs], QueryBlocksResult>, - 'set_mutual_tls_certificate' : ActorMethod<[string], ApiEmptyResult>, - 'update_akt_balance' : ActorMethod<[bigint], ApiFloatResult>, - 'update_deployment_state' : ActorMethod< - [string, DeploymentState], - ApiEmptyResult - >, - 'update_test_deployment_sdl' : ActorMethod<[string], ApiEmptyResult>, - 'ws_close' : ActorMethod<[CanisterWsCloseArguments], CanisterWsCloseResult>, - 'ws_get_messages' : ActorMethod< - [CanisterWsGetMessagesArguments], - CanisterWsGetMessagesResult - >, - 'ws_message' : ActorMethod< - [CanisterWsMessageArguments, [] | [DeploymentUpdateWsMessage]], - CanisterWsMessageResult - >, - 'ws_open' : ActorMethod<[CanisterWsOpenArguments], CanisterWsOpenResult>, -} -export declare const idlFactory: IDL.InterfaceFactory; -export declare const init: (args: { IDL: typeof IDL }) => IDL.Type[]; diff --git a/src/backend/frontend/declarations/backend.did.js b/src/backend/frontend/declarations/backend.did.js deleted file mode 100644 index b7ccf10..0000000 --- a/src/backend/frontend/declarations/backend.did.js +++ /dev/null @@ -1,305 +0,0 @@ -export const idlFactory = ({ IDL }) => { - const ApiError = IDL.Record({ 'code' : IDL.Nat16, 'message' : IDL.Text }); - const ApiStringResult = IDL.Variant({ 'Ok' : IDL.Text, 'Err' : ApiError }); - const ApiNatResult = IDL.Variant({ 'Ok' : IDL.Nat64, 'Err' : ApiError }); - const ApiEmptyResult = IDL.Variant({ 'Ok' : IDL.Null, 'Err' : ApiError }); - const CpuSize = IDL.Variant({ - 'Large' : IDL.Null, - 'Small' : IDL.Null, - 'Medium' : IDL.Null, - }); - const MemorySize = IDL.Variant({ - 'Large' : IDL.Null, - 'Small' : IDL.Null, - 'Medium' : IDL.Null, - }); - const StorageSize = IDL.Variant({ - 'Large' : IDL.Null, - 'Small' : IDL.Null, - 'Medium' : IDL.Null, - }); - const DeploymentParams = IDL.Record({ - 'cpu' : CpuSize, - 'memory' : MemorySize, - 'storage' : StorageSize, - 'name' : IDL.Text, - 'volume_mount' : IDL.Opt(IDL.Text), - 'command' : IDL.Vec(IDL.Text), - 'env_vars' : IDL.Vec(IDL.Tuple(IDL.Text, IDL.Text)), - 'image' : IDL.Text, - 'ports' : IDL.Vec( - IDL.Record({ - 'container_port' : IDL.Nat32, - 'domain' : IDL.Opt(IDL.Text), - 'host_port' : IDL.Nat32, - }) - ), - }); - const DeploymentId = IDL.Text; - const CreateDeploymentResult = IDL.Variant({ - 'Ok' : DeploymentId, - 'Err' : ApiError, - }); - const UserId = IDL.Principal; - const CreateUserResult = IDL.Variant({ 'Ok' : UserId, 'Err' : ApiError }); - const TimestampNs = IDL.Nat64; - const DeploymentState = IDL.Variant({ - 'FailedOnClient' : IDL.Record({ 'reason' : IDL.Text }), - 'Initialized' : IDL.Null, - 'DeploymentCreated' : IDL.Record({ - 'manifest_sorted_json' : IDL.Text, - 'dseq' : IDL.Nat64, - 'tx_hash' : IDL.Text, - }), - 'Closed' : IDL.Null, - 'Active' : IDL.Null, - 'LeaseCreated' : IDL.Record({ - 'provider_url' : IDL.Text, - 'tx_hash' : IDL.Text, - }), - 'FailedOnCanister' : IDL.Record({ 'reason' : IDL.Text }), - }); - const Deployment = IDL.Record({ - 'user_id' : UserId, - 'icp_price' : IDL.Float64, - 'state_history' : IDL.Vec(IDL.Tuple(TimestampNs, DeploymentState)), - 'params' : DeploymentParams, - }); - const GetDeploymentResult = IDL.Variant({ - 'Ok' : IDL.Record({ 'id' : DeploymentId, 'deployment' : Deployment }), - 'Err' : ApiError, - }); - const ApiFloatResult = IDL.Variant({ 'Ok' : IDL.Float64, 'Err' : ApiError }); - const GetDeploymentsResult = IDL.Variant({ - 'Ok' : IDL.Vec( - IDL.Record({ 'id' : DeploymentId, 'deployment' : Deployment }) - ), - 'Err' : ApiError, - }); - const UserRole = IDL.Variant({ 'Admin' : IDL.Null, 'Deployer' : IDL.Null }); - const User = IDL.Record({ - 'akt_balance' : IDL.Float64, - 'payments' : IDL.Vec(IDL.Nat64), - 'role' : UserRole, - 'created_at' : TimestampNs, - }); - const GetUserResult = IDL.Variant({ 'Ok' : User, 'Err' : ApiError }); - const LogLevel = IDL.Variant({ - 'info' : IDL.Null, - 'warn' : IDL.Null, - 'error' : IDL.Null, - }); - const LogsFilterRequest = IDL.Record({ - 'context_contains_any' : IDL.Opt(IDL.Vec(IDL.Text)), - 'level' : IDL.Opt(LogLevel), - 'message_contains_any' : IDL.Opt(IDL.Vec(IDL.Text)), - 'after_timestamp_ms' : IDL.Opt(IDL.Nat64), - 'before_timestamp_ms' : IDL.Opt(IDL.Nat64), - }); - const LogEntry = IDL.Record({ - 'context' : IDL.Opt(IDL.Text), - 'date_time' : IDL.Text, - 'level' : LogLevel, - 'message' : IDL.Text, - }); - const ListLogsResponse = IDL.Variant({ - 'Ok' : IDL.Record({ 'logs' : IDL.Vec(LogEntry) }), - 'Err' : ApiError, - }); - const BlockIndex = IDL.Nat64; - const GetBlocksArgs = IDL.Record({ - 'start' : BlockIndex, - 'length' : IDL.Nat64, - }); - const Memo = IDL.Nat64; - const Tokens = IDL.Record({ 'e8s' : IDL.Nat64 }); - const AccountIdentifier = IDL.Vec(IDL.Nat8); - const TimeStamp = IDL.Record({ 'timestamp_nanos' : IDL.Nat64 }); - const Operation = IDL.Variant({ - 'Approve' : IDL.Record({ - 'fee' : Tokens, - 'from' : AccountIdentifier, - 'allowance_e8s' : IDL.Int, - 'allowance' : Tokens, - 'expires_at' : IDL.Opt(TimeStamp), - 'spender' : AccountIdentifier, - }), - 'Burn' : IDL.Record({ - 'from' : AccountIdentifier, - 'amount' : Tokens, - 'spender' : IDL.Opt(AccountIdentifier), - }), - 'Mint' : IDL.Record({ 'to' : AccountIdentifier, 'amount' : Tokens }), - 'Transfer' : IDL.Record({ - 'to' : AccountIdentifier, - 'fee' : Tokens, - 'from' : AccountIdentifier, - 'amount' : Tokens, - }), - 'TransferFrom' : IDL.Record({ - 'to' : AccountIdentifier, - 'fee' : Tokens, - 'from' : AccountIdentifier, - 'amount' : Tokens, - 'spender' : AccountIdentifier, - }), - }); - const Transaction = IDL.Record({ - 'memo' : Memo, - 'icrc1_memo' : IDL.Opt(IDL.Vec(IDL.Nat8)), - 'operation' : IDL.Opt(Operation), - 'created_at_time' : TimeStamp, - }); - const Block = IDL.Record({ - 'transaction' : Transaction, - 'timestamp' : TimeStamp, - 'parent_hash' : IDL.Opt(IDL.Vec(IDL.Nat8)), - }); - const BlockRange = IDL.Record({ 'blocks' : IDL.Vec(Block) }); - const QueryArchiveError = IDL.Variant({ - 'BadFirstBlockIndex' : IDL.Record({ - 'requested_index' : BlockIndex, - 'first_valid_index' : BlockIndex, - }), - 'Other' : IDL.Record({ - 'error_message' : IDL.Text, - 'error_code' : IDL.Nat64, - }), - }); - const QueryArchiveResult = IDL.Variant({ - 'Ok' : BlockRange, - 'Err' : QueryArchiveError, - }); - const QueryArchiveFn = IDL.Func( - [GetBlocksArgs], - [QueryArchiveResult], - ['query'], - ); - const ArchivedBlocksRange = IDL.Record({ - 'callback' : QueryArchiveFn, - 'start' : BlockIndex, - 'length' : IDL.Nat64, - }); - const QueryBlocksResponse = IDL.Record({ - 'certificate' : IDL.Opt(IDL.Vec(IDL.Nat8)), - 'blocks' : IDL.Vec(Block), - 'chain_length' : IDL.Nat64, - 'first_block_index' : BlockIndex, - 'archived_blocks' : IDL.Vec(ArchivedBlocksRange), - }); - const QueryBlocksResult = IDL.Variant({ - 'Ok' : QueryBlocksResponse, - 'Err' : ApiError, - }); - const ClientPrincipal = IDL.Principal; - const ClientKey = IDL.Record({ - 'client_principal' : ClientPrincipal, - 'client_nonce' : IDL.Nat64, - }); - const CanisterWsCloseArguments = IDL.Record({ 'client_key' : ClientKey }); - const CanisterWsCloseResult = IDL.Variant({ - 'Ok' : IDL.Null, - 'Err' : IDL.Text, - }); - const CanisterWsGetMessagesArguments = IDL.Record({ 'nonce' : IDL.Nat64 }); - const CanisterOutputMessage = IDL.Record({ - 'key' : IDL.Text, - 'content' : IDL.Vec(IDL.Nat8), - 'client_key' : ClientKey, - }); - const CanisterOutputCertifiedMessages = IDL.Record({ - 'messages' : IDL.Vec(CanisterOutputMessage), - 'cert' : IDL.Vec(IDL.Nat8), - 'tree' : IDL.Vec(IDL.Nat8), - 'is_end_of_queue' : IDL.Bool, - }); - const CanisterWsGetMessagesResult = IDL.Variant({ - 'Ok' : CanisterOutputCertifiedMessages, - 'Err' : IDL.Text, - }); - const WebsocketMessage = IDL.Record({ - 'sequence_num' : IDL.Nat64, - 'content' : IDL.Vec(IDL.Nat8), - 'client_key' : ClientKey, - 'timestamp' : IDL.Nat64, - 'is_service_message' : IDL.Bool, - }); - const CanisterWsMessageArguments = IDL.Record({ 'msg' : WebsocketMessage }); - const DeploymentUpdateWsMessage = IDL.Record({ - 'id' : IDL.Text, - 'update' : DeploymentState, - }); - const CanisterWsMessageResult = IDL.Variant({ - 'Ok' : IDL.Null, - 'Err' : IDL.Text, - }); - const GatewayPrincipal = IDL.Principal; - const CanisterWsOpenArguments = IDL.Record({ - 'gateway_principal' : GatewayPrincipal, - 'client_nonce' : IDL.Nat64, - }); - const CanisterWsOpenResult = IDL.Variant({ - 'Ok' : IDL.Null, - 'Err' : IDL.Text, - }); - return IDL.Service({ - 'address' : IDL.Func([], [ApiStringResult], []), - 'balance' : IDL.Func([], [ApiNatResult], []), - 'check_tx' : IDL.Func([IDL.Text], [ApiEmptyResult], []), - 'close_deployment' : IDL.Func([IDL.Text], [ApiEmptyResult], []), - 'create_certificate' : IDL.Func( - [IDL.Text, IDL.Text], - [ApiStringResult], - [], - ), - 'create_deployment' : IDL.Func( - [DeploymentParams], - [CreateDeploymentResult], - [], - ), - 'create_test_deployment' : IDL.Func([], [CreateDeploymentResult], []), - 'create_user' : IDL.Func([], [CreateUserResult], []), - 'deposit_deployment' : IDL.Func( - [IDL.Text, IDL.Nat64], - [ApiEmptyResult], - [], - ), - 'get_deployment' : IDL.Func([IDL.Text], [GetDeploymentResult], ['query']), - 'get_deployment_icp_price' : IDL.Func([], [ApiFloatResult], []), - 'get_deployments' : IDL.Func([], [GetDeploymentsResult], ['query']), - 'get_my_user' : IDL.Func([], [GetUserResult], ['query']), - 'get_user' : IDL.Func([IDL.Principal], [GetUserResult], ['query']), - 'list_logs' : IDL.Func([LogsFilterRequest], [ListLogsResponse], ['query']), - 'promote_user_to_admin' : IDL.Func([UserId], [ApiEmptyResult], []), - 'query_blocks' : IDL.Func( - [GetBlocksArgs], - [QueryBlocksResult], - ['composite_query'], - ), - 'set_mutual_tls_certificate' : IDL.Func([IDL.Text], [ApiEmptyResult], []), - 'update_akt_balance' : IDL.Func([IDL.Nat64], [ApiFloatResult], []), - 'update_deployment_state' : IDL.Func( - [IDL.Text, DeploymentState], - [ApiEmptyResult], - [], - ), - 'update_test_deployment_sdl' : IDL.Func([IDL.Text], [ApiEmptyResult], []), - 'ws_close' : IDL.Func( - [CanisterWsCloseArguments], - [CanisterWsCloseResult], - [], - ), - 'ws_get_messages' : IDL.Func( - [CanisterWsGetMessagesArguments], - [CanisterWsGetMessagesResult], - ['query'], - ), - 'ws_message' : IDL.Func( - [CanisterWsMessageArguments, IDL.Opt(DeploymentUpdateWsMessage)], - [CanisterWsMessageResult], - [], - ), - 'ws_open' : IDL.Func([CanisterWsOpenArguments], [CanisterWsOpenResult], []), - }); -}; -export const init = ({ IDL }) => { return [IDL.Bool]; }; diff --git a/src/backend/frontend/declarations/index.d.ts b/src/backend/frontend/declarations/index.d.ts deleted file mode 100644 index 55daa14..0000000 --- a/src/backend/frontend/declarations/index.d.ts +++ /dev/null @@ -1,50 +0,0 @@ -import type { - ActorSubclass, - HttpAgentOptions, - ActorConfig, - Agent, -} from "@dfinity/agent"; -import type { Principal } from "@dfinity/principal"; -import type { IDL } from "@dfinity/candid"; - -import { _SERVICE } from './backend.did'; - -export declare const idlFactory: IDL.InterfaceFactory; -export declare const canisterId: string; - -export declare interface CreateActorOptions { - /** - * @see {@link Agent} - */ - agent?: Agent; - /** - * @see {@link HttpAgentOptions} - */ - agentOptions?: HttpAgentOptions; - /** - * @see {@link ActorConfig} - */ - actorOptions?: ActorConfig; -} - -/** - * Intializes an {@link ActorSubclass}, configured with the provided SERVICE interface of a canister. - * @constructs {@link ActorSubClass} - * @param {string | Principal} canisterId - ID of the canister the {@link Actor} will talk to - * @param {CreateActorOptions} options - see {@link CreateActorOptions} - * @param {CreateActorOptions["agent"]} options.agent - a pre-configured agent you'd like to use. Supercedes agentOptions - * @param {CreateActorOptions["agentOptions"]} options.agentOptions - options to set up a new agent - * @see {@link HttpAgentOptions} - * @param {CreateActorOptions["actorOptions"]} options.actorOptions - options for the Actor - * @see {@link ActorConfig} - */ -export declare const createActor: ( - canisterId: string | Principal, - options?: CreateActorOptions -) => ActorSubclass<_SERVICE>; - -/** - * Intialized Actor using default settings, ready to talk to a canister using its candid interface - * @constructs {@link ActorSubClass} - */ -export declare const backend: ActorSubclass<_SERVICE>; diff --git a/src/backend/frontend/declarations/index.js b/src/backend/frontend/declarations/index.js deleted file mode 100644 index 8def379..0000000 --- a/src/backend/frontend/declarations/index.js +++ /dev/null @@ -1,42 +0,0 @@ -import { Actor, HttpAgent } from "@dfinity/agent"; - -// Imports and re-exports candid interface -import { idlFactory } from "./backend.did.js"; -export { idlFactory } from "./backend.did.js"; - -/* CANISTER_ID is replaced by webpack based on node environment - * Note: canister environment variable will be standardized as - * process.env.CANISTER_ID_ - * beginning in dfx 0.15.0 - */ -export const canisterId = - process.env.CANISTER_ID_BACKEND; - -export const createActor = (canisterId, options = {}) => { - const agent = options.agent || new HttpAgent({ ...options.agentOptions }); - - if (options.agent && options.agentOptions) { - console.warn( - "Detected both agent and agentOptions passed to createActor. Ignoring agentOptions and proceeding with the provided agent." - ); - } - - // Fetch root key for certificate validation during development - if (process.env.DFX_NETWORK !== "ic") { - agent.fetchRootKey().catch((err) => { - console.warn( - "Unable to fetch root key. Check to ensure that your local replica is running" - ); - console.error(err); - }); - } - - // Creates an actor with using the candid interface and the HttpAgent - return Actor.createActor(idlFactory, { - agent, - canisterId, - ...options.actorOptions, - }); -}; - -export const backend = canisterId ? createActor(canisterId) : undefined;