@yellow-org/sdk 1.0.1-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +999 -0
- package/dist/abis/generated.d.ts +4300 -0
- package/dist/abis/generated.js +1 -0
- package/dist/app/index.d.ts +2 -0
- package/dist/app/index.js +2 -0
- package/dist/app/packing.d.ts +7 -0
- package/dist/app/packing.js +111 -0
- package/dist/app/types.d.ts +91 -0
- package/dist/app/types.js +42 -0
- package/dist/asset_store.d.ts +13 -0
- package/dist/asset_store.js +121 -0
- package/dist/blockchain/evm/channel_hub_abi.d.ts +4284 -0
- package/dist/blockchain/evm/channel_hub_abi.js +5475 -0
- package/dist/blockchain/evm/client.d.ts +46 -0
- package/dist/blockchain/evm/client.js +428 -0
- package/dist/blockchain/evm/erc20.d.ts +13 -0
- package/dist/blockchain/evm/erc20.js +54 -0
- package/dist/blockchain/evm/erc20_abi.d.ts +144 -0
- package/dist/blockchain/evm/erc20_abi.js +96 -0
- package/dist/blockchain/evm/index.d.ts +6 -0
- package/dist/blockchain/evm/index.js +6 -0
- package/dist/blockchain/evm/interface.d.ts +10 -0
- package/dist/blockchain/evm/interface.js +1 -0
- package/dist/blockchain/evm/types.d.ts +27 -0
- package/dist/blockchain/evm/types.js +1 -0
- package/dist/blockchain/evm/utils.d.ts +9 -0
- package/dist/blockchain/evm/utils.js +129 -0
- package/dist/blockchain/index.d.ts +1 -0
- package/dist/blockchain/index.js +1 -0
- package/dist/client.d.ts +99 -0
- package/dist/client.js +720 -0
- package/dist/config.d.ts +12 -0
- package/dist/config.js +28 -0
- package/dist/core/event.d.ts +29 -0
- package/dist/core/event.js +1 -0
- package/dist/core/index.d.ts +6 -0
- package/dist/core/index.js +6 -0
- package/dist/core/interface.d.ts +53 -0
- package/dist/core/interface.js +1 -0
- package/dist/core/state.d.ts +21 -0
- package/dist/core/state.js +267 -0
- package/dist/core/state_packer.d.ts +13 -0
- package/dist/core/state_packer.js +98 -0
- package/dist/core/types.d.ts +203 -0
- package/dist/core/types.js +220 -0
- package/dist/core/utils.d.ts +16 -0
- package/dist/core/utils.js +181 -0
- package/dist/index.d.ts +9 -0
- package/dist/index.js +9 -0
- package/dist/rpc/api.d.ts +181 -0
- package/dist/rpc/api.js +1 -0
- package/dist/rpc/client.d.ts +36 -0
- package/dist/rpc/client.js +102 -0
- package/dist/rpc/dialer.d.ts +30 -0
- package/dist/rpc/dialer.js +146 -0
- package/dist/rpc/error.d.ts +18 -0
- package/dist/rpc/error.js +27 -0
- package/dist/rpc/index.d.ts +7 -0
- package/dist/rpc/index.js +7 -0
- package/dist/rpc/message.d.ts +25 -0
- package/dist/rpc/message.js +102 -0
- package/dist/rpc/methods.d.ts +30 -0
- package/dist/rpc/methods.js +27 -0
- package/dist/rpc/types.d.ts +101 -0
- package/dist/rpc/types.js +1 -0
- package/dist/signers.d.ts +48 -0
- package/dist/signers.js +96 -0
- package/dist/utils/sign.d.ts +2 -0
- package/dist/utils/sign.js +8 -0
- package/dist/utils.d.ts +42 -0
- package/dist/utils.js +226 -0
- package/package.json +89 -0
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
export const Erc20Abi = [
|
|
2
|
+
{
|
|
3
|
+
type: 'function',
|
|
4
|
+
name: 'name',
|
|
5
|
+
inputs: [],
|
|
6
|
+
outputs: [{ name: '', type: 'string' }],
|
|
7
|
+
stateMutability: 'view',
|
|
8
|
+
},
|
|
9
|
+
{
|
|
10
|
+
type: 'function',
|
|
11
|
+
name: 'symbol',
|
|
12
|
+
inputs: [],
|
|
13
|
+
outputs: [{ name: '', type: 'string' }],
|
|
14
|
+
stateMutability: 'view',
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
type: 'function',
|
|
18
|
+
name: 'decimals',
|
|
19
|
+
inputs: [],
|
|
20
|
+
outputs: [{ name: '', type: 'uint8' }],
|
|
21
|
+
stateMutability: 'view',
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
type: 'function',
|
|
25
|
+
name: 'totalSupply',
|
|
26
|
+
inputs: [],
|
|
27
|
+
outputs: [{ name: '', type: 'uint256' }],
|
|
28
|
+
stateMutability: 'view',
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
type: 'function',
|
|
32
|
+
name: 'balanceOf',
|
|
33
|
+
inputs: [{ name: 'account', type: 'address' }],
|
|
34
|
+
outputs: [{ name: '', type: 'uint256' }],
|
|
35
|
+
stateMutability: 'view',
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
type: 'function',
|
|
39
|
+
name: 'transfer',
|
|
40
|
+
inputs: [
|
|
41
|
+
{ name: 'to', type: 'address' },
|
|
42
|
+
{ name: 'amount', type: 'uint256' },
|
|
43
|
+
],
|
|
44
|
+
outputs: [{ name: '', type: 'bool' }],
|
|
45
|
+
stateMutability: 'nonpayable',
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
type: 'function',
|
|
49
|
+
name: 'allowance',
|
|
50
|
+
inputs: [
|
|
51
|
+
{ name: 'owner', type: 'address' },
|
|
52
|
+
{ name: 'spender', type: 'address' },
|
|
53
|
+
],
|
|
54
|
+
outputs: [{ name: '', type: 'uint256' }],
|
|
55
|
+
stateMutability: 'view',
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
type: 'function',
|
|
59
|
+
name: 'approve',
|
|
60
|
+
inputs: [
|
|
61
|
+
{ name: 'spender', type: 'address' },
|
|
62
|
+
{ name: 'amount', type: 'uint256' },
|
|
63
|
+
],
|
|
64
|
+
outputs: [{ name: '', type: 'bool' }],
|
|
65
|
+
stateMutability: 'nonpayable',
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
type: 'function',
|
|
69
|
+
name: 'transferFrom',
|
|
70
|
+
inputs: [
|
|
71
|
+
{ name: 'from', type: 'address' },
|
|
72
|
+
{ name: 'to', type: 'address' },
|
|
73
|
+
{ name: 'amount', type: 'uint256' },
|
|
74
|
+
],
|
|
75
|
+
outputs: [{ name: '', type: 'bool' }],
|
|
76
|
+
stateMutability: 'nonpayable',
|
|
77
|
+
},
|
|
78
|
+
{
|
|
79
|
+
type: 'event',
|
|
80
|
+
name: 'Transfer',
|
|
81
|
+
inputs: [
|
|
82
|
+
{ name: 'from', type: 'address', indexed: true },
|
|
83
|
+
{ name: 'to', type: 'address', indexed: true },
|
|
84
|
+
{ name: 'value', type: 'uint256', indexed: false },
|
|
85
|
+
],
|
|
86
|
+
},
|
|
87
|
+
{
|
|
88
|
+
type: 'event',
|
|
89
|
+
name: 'Approval',
|
|
90
|
+
inputs: [
|
|
91
|
+
{ name: 'owner', type: 'address', indexed: true },
|
|
92
|
+
{ name: 'spender', type: 'address', indexed: true },
|
|
93
|
+
{ name: 'value', type: 'uint256', indexed: false },
|
|
94
|
+
],
|
|
95
|
+
},
|
|
96
|
+
];
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Address, PublicClient, WalletClient } from 'viem';
|
|
2
|
+
export interface AssetStore {
|
|
3
|
+
getAssetDecimals(asset: string): Promise<number>;
|
|
4
|
+
getTokenDecimals(blockchainId: bigint, tokenAddress: Address): Promise<number>;
|
|
5
|
+
getTokenAddress(asset: string, blockchainId: bigint): Promise<Address>;
|
|
6
|
+
}
|
|
7
|
+
export interface EVMClient extends PublicClient {
|
|
8
|
+
}
|
|
9
|
+
export interface WalletSigner extends WalletClient {
|
|
10
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { Address } from 'viem';
|
|
2
|
+
export interface ChannelDefinition {
|
|
3
|
+
challengeDuration: number;
|
|
4
|
+
user: Address;
|
|
5
|
+
node: Address;
|
|
6
|
+
nonce: bigint;
|
|
7
|
+
approvedSignatureValidators: bigint;
|
|
8
|
+
metadata: `0x${string}`;
|
|
9
|
+
}
|
|
10
|
+
export interface Ledger {
|
|
11
|
+
chainId: bigint;
|
|
12
|
+
token: Address;
|
|
13
|
+
decimals: number;
|
|
14
|
+
userAllocation: bigint;
|
|
15
|
+
userNetFlow: bigint;
|
|
16
|
+
nodeAllocation: bigint;
|
|
17
|
+
nodeNetFlow: bigint;
|
|
18
|
+
}
|
|
19
|
+
export interface State {
|
|
20
|
+
version: bigint;
|
|
21
|
+
intent: number;
|
|
22
|
+
metadata: `0x${string}`;
|
|
23
|
+
homeLedger: Ledger;
|
|
24
|
+
nonHomeLedger: Ledger;
|
|
25
|
+
userSig: `0x${string}`;
|
|
26
|
+
nodeSig: `0x${string}`;
|
|
27
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Address } from 'viem';
|
|
2
|
+
import * as core from '../../core/types';
|
|
3
|
+
import { ChannelDefinition, Ledger, State } from './types';
|
|
4
|
+
export declare function hexToBytes32(s: string): Uint8Array;
|
|
5
|
+
export declare function coreDefToContractDef(def: core.ChannelDefinition, asset: string, userWallet: Address, nodeAddress: Address): ChannelDefinition;
|
|
6
|
+
export declare function coreStateToContractState(state: core.State, tokenGetter: (blockchainId: bigint, tokenAddress: Address) => Promise<number>): Promise<State>;
|
|
7
|
+
export declare function coreLedgerToContractLedger(ledger: core.Ledger, decimals: number): Ledger;
|
|
8
|
+
export declare function contractStateToCoreState(contractState: State, homeChannelId: string, escrowChannelId?: string): core.State;
|
|
9
|
+
export declare function contractLedgerToCoreLedger(ledger: Ledger): core.Ledger;
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
import { hexToBytes } from 'viem';
|
|
2
|
+
import Decimal from 'decimal.js';
|
|
3
|
+
import * as core from '../../core/types';
|
|
4
|
+
import { decimalToBigInt, generateChannelMetadata, getStateTransitionHash } from '../../core/utils';
|
|
5
|
+
export function hexToBytes32(s) {
|
|
6
|
+
const bytes = hexToBytes(s);
|
|
7
|
+
if (bytes.length !== 32) {
|
|
8
|
+
throw new Error(`invalid length: expected 32 bytes, got ${bytes.length}`);
|
|
9
|
+
}
|
|
10
|
+
return bytes;
|
|
11
|
+
}
|
|
12
|
+
export function coreDefToContractDef(def, asset, userWallet, nodeAddress) {
|
|
13
|
+
return {
|
|
14
|
+
challengeDuration: def.challenge,
|
|
15
|
+
user: userWallet,
|
|
16
|
+
node: nodeAddress,
|
|
17
|
+
nonce: def.nonce,
|
|
18
|
+
approvedSignatureValidators: BigInt(def.approvedSigValidators || '0x00'),
|
|
19
|
+
metadata: generateChannelMetadata(asset),
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
export async function coreStateToContractState(state, tokenGetter) {
|
|
23
|
+
const homeDecimals = await tokenGetter(state.homeLedger.blockchainId, state.homeLedger.tokenAddress);
|
|
24
|
+
const homeLedger = coreLedgerToContractLedger(state.homeLedger, homeDecimals);
|
|
25
|
+
let nonHomeLedger;
|
|
26
|
+
if (state.escrowLedger) {
|
|
27
|
+
const nonHomeDecimals = await tokenGetter(state.escrowLedger.blockchainId, state.escrowLedger.tokenAddress);
|
|
28
|
+
nonHomeLedger = coreLedgerToContractLedger(state.escrowLedger, nonHomeDecimals);
|
|
29
|
+
}
|
|
30
|
+
else {
|
|
31
|
+
nonHomeLedger = {
|
|
32
|
+
chainId: 0n,
|
|
33
|
+
token: '0x0000000000000000000000000000000000000000',
|
|
34
|
+
decimals: 0,
|
|
35
|
+
userAllocation: 0n,
|
|
36
|
+
userNetFlow: 0n,
|
|
37
|
+
nodeAllocation: 0n,
|
|
38
|
+
nodeNetFlow: 0n,
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
const intent = transitionTypeToIntent(state.transition.type);
|
|
42
|
+
const metadata = getStateTransitionHash(state.transition);
|
|
43
|
+
const userSig = state.userSig ? state.userSig : '0x';
|
|
44
|
+
const nodeSig = state.nodeSig ? state.nodeSig : '0x';
|
|
45
|
+
return {
|
|
46
|
+
version: state.version,
|
|
47
|
+
intent,
|
|
48
|
+
metadata,
|
|
49
|
+
homeLedger: homeLedger,
|
|
50
|
+
nonHomeLedger: nonHomeLedger,
|
|
51
|
+
userSig,
|
|
52
|
+
nodeSig,
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
export function coreLedgerToContractLedger(ledger, decimals) {
|
|
56
|
+
const userAllocation = decimalToBigInt(ledger.userBalance, decimals);
|
|
57
|
+
const userNetFlow = decimalToBigInt(ledger.userNetFlow, decimals);
|
|
58
|
+
const nodeAllocation = decimalToBigInt(ledger.nodeBalance, decimals);
|
|
59
|
+
const nodeNetFlow = decimalToBigInt(ledger.nodeNetFlow, decimals);
|
|
60
|
+
return {
|
|
61
|
+
chainId: ledger.blockchainId,
|
|
62
|
+
token: ledger.tokenAddress,
|
|
63
|
+
decimals,
|
|
64
|
+
userAllocation,
|
|
65
|
+
userNetFlow,
|
|
66
|
+
nodeAllocation,
|
|
67
|
+
nodeNetFlow,
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
export function contractStateToCoreState(contractState, homeChannelId, escrowChannelId) {
|
|
71
|
+
const homeLedger = contractLedgerToCoreLedger(contractState.homeLedger);
|
|
72
|
+
let escrowLedger;
|
|
73
|
+
if (contractState.nonHomeLedger.chainId !== 0n) {
|
|
74
|
+
escrowLedger = contractLedgerToCoreLedger(contractState.nonHomeLedger);
|
|
75
|
+
}
|
|
76
|
+
const homeChannelIdPtr = homeChannelId || undefined;
|
|
77
|
+
const escrowChannelIdPtr = escrowChannelId || undefined;
|
|
78
|
+
let userSig;
|
|
79
|
+
let nodeSig;
|
|
80
|
+
if (contractState.userSig && contractState.userSig !== '0x') {
|
|
81
|
+
userSig = contractState.userSig;
|
|
82
|
+
}
|
|
83
|
+
if (contractState.nodeSig && contractState.nodeSig !== '0x') {
|
|
84
|
+
nodeSig = contractState.nodeSig;
|
|
85
|
+
}
|
|
86
|
+
return {
|
|
87
|
+
id: '',
|
|
88
|
+
transition: { type: core.TransitionType.Void, txId: '', amount: new Decimal(0) },
|
|
89
|
+
asset: '',
|
|
90
|
+
userWallet: '0x0000000000000000000000000000000000000000',
|
|
91
|
+
epoch: 0n,
|
|
92
|
+
version: contractState.version,
|
|
93
|
+
homeChannelId: homeChannelIdPtr,
|
|
94
|
+
escrowChannelId: escrowChannelIdPtr,
|
|
95
|
+
homeLedger,
|
|
96
|
+
escrowLedger,
|
|
97
|
+
userSig,
|
|
98
|
+
nodeSig,
|
|
99
|
+
};
|
|
100
|
+
}
|
|
101
|
+
export function contractLedgerToCoreLedger(ledger) {
|
|
102
|
+
const exp = -ledger.decimals;
|
|
103
|
+
return {
|
|
104
|
+
blockchainId: ledger.chainId,
|
|
105
|
+
tokenAddress: ledger.token,
|
|
106
|
+
userBalance: new Decimal(ledger.userAllocation.toString()).mul(Decimal.pow(10, exp)),
|
|
107
|
+
userNetFlow: new Decimal(ledger.userNetFlow.toString()).mul(Decimal.pow(10, exp)),
|
|
108
|
+
nodeBalance: new Decimal(ledger.nodeAllocation.toString()).mul(Decimal.pow(10, exp)),
|
|
109
|
+
nodeNetFlow: new Decimal(ledger.nodeNetFlow.toString()).mul(Decimal.pow(10, exp)),
|
|
110
|
+
};
|
|
111
|
+
}
|
|
112
|
+
function transitionTypeToIntent(transitionType) {
|
|
113
|
+
switch (transitionType) {
|
|
114
|
+
case core.TransitionType.HomeDeposit:
|
|
115
|
+
return core.INTENT_DEPOSIT;
|
|
116
|
+
case core.TransitionType.HomeWithdrawal:
|
|
117
|
+
return core.INTENT_WITHDRAW;
|
|
118
|
+
case core.TransitionType.Finalize:
|
|
119
|
+
return core.INTENT_CLOSE;
|
|
120
|
+
case core.TransitionType.EscrowDeposit:
|
|
121
|
+
return core.INTENT_INITIATE_ESCROW_DEPOSIT;
|
|
122
|
+
case core.TransitionType.EscrowWithdraw:
|
|
123
|
+
return core.INTENT_INITIATE_ESCROW_WITHDRAWAL;
|
|
124
|
+
case core.TransitionType.Migrate:
|
|
125
|
+
return core.INTENT_INITIATE_MIGRATION;
|
|
126
|
+
default:
|
|
127
|
+
return core.INTENT_OPERATE;
|
|
128
|
+
}
|
|
129
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * as evm from './evm';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * as evm from './evm';
|
package/dist/client.d.ts
ADDED
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import { Address, Hex } from 'viem';
|
|
2
|
+
import Decimal from 'decimal.js';
|
|
3
|
+
import * as core from './core';
|
|
4
|
+
import * as app from './app';
|
|
5
|
+
import { ChannelSessionKeyStateV1 } from './rpc/types';
|
|
6
|
+
import { Option } from './config';
|
|
7
|
+
import { StateSigner, TransactionSigner } from './signers';
|
|
8
|
+
export declare const DEFAULT_CHALLENGE_PERIOD = 86400;
|
|
9
|
+
export type { StateSigner, TransactionSigner };
|
|
10
|
+
export declare class Client {
|
|
11
|
+
private rpcClient;
|
|
12
|
+
private config;
|
|
13
|
+
private exitPromise;
|
|
14
|
+
private exitResolve?;
|
|
15
|
+
private blockchainClients;
|
|
16
|
+
private homeBlockchains;
|
|
17
|
+
private stateSigner;
|
|
18
|
+
private txSigner;
|
|
19
|
+
private assetStore;
|
|
20
|
+
private constructor();
|
|
21
|
+
static create(wsURL: string, stateSigner: StateSigner, txSigner: TransactionSigner, ...opts: Option[]): Promise<Client>;
|
|
22
|
+
setHomeBlockchain(asset: string, blockchainId: bigint): Promise<void>;
|
|
23
|
+
close(): Promise<void>;
|
|
24
|
+
waitForClose(): Promise<void>;
|
|
25
|
+
signState(state: core.State): Promise<Hex>;
|
|
26
|
+
getUserAddress(): Address;
|
|
27
|
+
private signAndSubmitState;
|
|
28
|
+
deposit(blockchainId: bigint, asset: string, amount: Decimal): Promise<core.State>;
|
|
29
|
+
withdraw(blockchainId: bigint, asset: string, amount: Decimal): Promise<core.State>;
|
|
30
|
+
transfer(recipientWallet: string, asset: string, amount: Decimal): Promise<core.State>;
|
|
31
|
+
acknowledge(asset: string): Promise<core.State>;
|
|
32
|
+
closeHomeChannel(asset: string): Promise<core.State>;
|
|
33
|
+
checkpoint(asset: string): Promise<string>;
|
|
34
|
+
challenge(state: core.State): Promise<string>;
|
|
35
|
+
approveToken(chainId: bigint, asset: string, amount: Decimal): Promise<string>;
|
|
36
|
+
checkTokenAllowance(chainId: bigint, tokenAddress: string, owner: string): Promise<bigint>;
|
|
37
|
+
ping(): Promise<void>;
|
|
38
|
+
getConfig(): Promise<core.NodeConfig>;
|
|
39
|
+
getBlockchains(): Promise<core.Blockchain[]>;
|
|
40
|
+
getAssets(blockchainId?: bigint): Promise<core.Asset[]>;
|
|
41
|
+
getBalances(wallet: Address): Promise<core.BalanceEntry[]>;
|
|
42
|
+
getTransactions(wallet: Address, options?: {
|
|
43
|
+
asset?: string;
|
|
44
|
+
txType?: core.TransactionType;
|
|
45
|
+
fromTime?: bigint;
|
|
46
|
+
toTime?: bigint;
|
|
47
|
+
page?: number;
|
|
48
|
+
pageSize?: number;
|
|
49
|
+
}): Promise<{
|
|
50
|
+
transactions: core.Transaction[];
|
|
51
|
+
metadata: core.PaginationMetadata;
|
|
52
|
+
}>;
|
|
53
|
+
getChannels(wallet: Address, options?: {
|
|
54
|
+
status?: string;
|
|
55
|
+
asset?: string;
|
|
56
|
+
channelType?: string;
|
|
57
|
+
pagination?: core.PaginationParams;
|
|
58
|
+
}): Promise<{
|
|
59
|
+
channels: core.Channel[];
|
|
60
|
+
metadata: core.PaginationMetadata;
|
|
61
|
+
}>;
|
|
62
|
+
getHomeChannel(wallet: Address, asset: string): Promise<core.Channel>;
|
|
63
|
+
getEscrowChannel(escrowChannelId: string): Promise<core.Channel>;
|
|
64
|
+
getLatestState(wallet: Address, asset: string, onlySigned: boolean): Promise<core.State>;
|
|
65
|
+
getAppSessions(options?: {
|
|
66
|
+
appSessionId?: string;
|
|
67
|
+
wallet?: Address;
|
|
68
|
+
status?: string;
|
|
69
|
+
page?: number;
|
|
70
|
+
pageSize?: number;
|
|
71
|
+
}): Promise<{
|
|
72
|
+
sessions: app.AppSessionInfoV1[];
|
|
73
|
+
metadata: core.PaginationMetadata;
|
|
74
|
+
}>;
|
|
75
|
+
getAppDefinition(appSessionId: string): Promise<app.AppDefinitionV1>;
|
|
76
|
+
createAppSession(definition: app.AppDefinitionV1, sessionData: string, quorumSigs: string[]): Promise<{
|
|
77
|
+
appSessionId: string;
|
|
78
|
+
version: string;
|
|
79
|
+
status: string;
|
|
80
|
+
}>;
|
|
81
|
+
submitAppSessionDeposit(appStateUpdate: app.AppStateUpdateV1, quorumSigs: string[], asset: string, depositAmount: Decimal): Promise<string>;
|
|
82
|
+
submitAppState(appStateUpdate: app.AppStateUpdateV1, quorumSigs: string[]): Promise<void>;
|
|
83
|
+
rebalanceAppSessions(signedUpdates: app.SignedAppStateUpdateV1[]): Promise<string>;
|
|
84
|
+
signChannelSessionKeyState(state: ChannelSessionKeyStateV1): Promise<Hex>;
|
|
85
|
+
submitChannelSessionKeyState(state: ChannelSessionKeyStateV1): Promise<void>;
|
|
86
|
+
getLastChannelKeyStates(userAddress: string, sessionKey?: string): Promise<ChannelSessionKeyStateV1[]>;
|
|
87
|
+
signSessionKeyState(state: app.AppSessionKeyStateV1): Promise<Hex>;
|
|
88
|
+
submitSessionKeyState(state: app.AppSessionKeyStateV1): Promise<void>;
|
|
89
|
+
getLastKeyStates(userAddress: string, sessionKey?: string): Promise<app.AppSessionKeyStateV1[]>;
|
|
90
|
+
private initializeBlockchainClient;
|
|
91
|
+
private buildSigValidatorsBitmap;
|
|
92
|
+
private getSupportedSigValidatorsBitmap;
|
|
93
|
+
private getNodeAddress;
|
|
94
|
+
private submitState;
|
|
95
|
+
private requestChannelCreation;
|
|
96
|
+
private transformStateToRPC;
|
|
97
|
+
private transformChannelDefinitionToRPC;
|
|
98
|
+
private transitionTypeToString;
|
|
99
|
+
}
|