Skip to content
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

add session proxy calls and getters to worker-api #125

Merged
merged 15 commits into from
Dec 12, 2024
2 changes: 1 addition & 1 deletion lerna.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@
"publishConfig": {
"directory": "build"
},
"version": "0.17.0-alpha.2"
"version": "0.18.0-alpha.3"
}
5 changes: 3 additions & 2 deletions packages/node-api/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"engines": {
"node": ">=18.14"
},
"gitHead": "1fa54c11ec73869718b9de521a143969c4cacc02",
"homepage": "https://github.com/encointer/encointer-js/tree/master/packages/node-api#readme",
"license": "GPL-3.0-or-later",
"name": "@encointer/node-api",
Expand All @@ -18,10 +19,10 @@
},
"sideEffects": false,
"type": "module",
"version": "0.17.0-alpha.2",
"version": "0.18.0-alpha.3",
"main": "index.js",
"dependencies": {
"@encointer/types": "^0.17.0-alpha.2",
"@encointer/types": "^0.18.0-alpha.3",
"@polkadot/api": "^11.2.1",
"tslib": "^2.6.2"
},
Expand Down
3 changes: 2 additions & 1 deletion packages/types/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"engines": {
"node": ">=18.14"
},
"gitHead": "1fa54c11ec73869718b9de521a143969c4cacc02",
"homepage": "https://github.com/encointer/encointer-js/tree/master/packages/types#readme",
"license": "GPL-3.0-or-later",
"name": "@encointer/types",
Expand All @@ -18,7 +19,7 @@
},
"sideEffects": false,
"type": "module",
"version": "0.17.0-alpha.2",
"version": "0.18.0-alpha.3",
"main": "index.js",
"scripts": {
"generate:defs": "node --experimental-specifier-resolution=node --loader ts-node/esm ../../node_modules/.bin/polkadot-types-from-defs --package @encointer/types/interfaces --input ./src/interfaces",
Expand Down
28 changes: 25 additions & 3 deletions packages/types/src/interfaces/integriteeWorker/definitions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ export default {
IntegriteeTrustedGetter: {
_enum: {
account_info: 'AccountId',
unused_index_1: null,
account_info_and_session_proxies: 'AccountId',
unused_index_2: null,
unused_index_3: null,
unused_index_4: null,
Expand Down Expand Up @@ -113,6 +113,7 @@ export default {
},
IntegriteeTrustedGetterSigned: {
getter: 'IntegriteeTrustedGetter',
delegate: 'Option<AccountId>',
signature: 'MultiSignature'
},
IntegriteeGetter: {
Expand All @@ -131,6 +132,7 @@ export default {
IntegriteeTrustedCallSigned: {
call: 'IntegriteeTrustedCall',
nonce: 'u32',
delegate: 'Option<AccountId>',
signature: 'MultiSignature'
},
IntegriteeTrustedCall: {
Expand All @@ -155,7 +157,7 @@ export default {
unused_index_17: null,
unused_index_18: null,
unused_index_19: null,
unused_index_20: null,
send_note: 'SendNoteArgs',
unused_index_21: null,
unused_index_22: null,
unused_index_23: null,
Expand All @@ -165,7 +167,7 @@ export default {
unused_index_27: null,
unused_index_28: null,
unused_index_29: null,
unused_index_30: null,
add_session_proxy: 'AddSessionProxyArgs',
unused_index_31: null,
unused_index_32: null,
unused_index_33: null,
Expand Down Expand Up @@ -231,6 +233,26 @@ export default {
AttemptsArg: {
origin: 'AccountId'
},
SessionProxyRole: {
_enum: {
readBalance: null,
readAny: null,
nonTransfer: null,
any: null,
transferAllowance: 'Balance'
}
},
SessionProxyCredentials: {
role: 'SessionProxyRole',
expiry: 'Option<Moment>',
seed: 'H256',
},
AddSessionProxyArgs: '(AccountId, AccountId, SessionProxyCredentials)',
AccountInfoAndSessionProxies: {
account_info: 'AccountInfo',
session_proxies: 'Vec<SessionProxyCredentials>'
},
SendNoteArgs: '(AccountId, AccountId, String)',
GuessTheNumberTrustedCall: {
_enum: {
set_winnings: 'GuessTheNumberSetWinningsArgs',
Expand Down
43 changes: 40 additions & 3 deletions packages/types/src/interfaces/integriteeWorker/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ import type { ParentchainId, ShardIdentifier } from '@encointer/types/interfaces
import type { Bytes, Enum, Option, Struct, Text, Vec, u16, u32, u64 } from '@polkadot/types-codec';
import type { ITuple } from '@polkadot/types-codec/types';
import type { MultiSignature } from '@polkadot/types/interfaces/extrinsics';
import type { AccountId, Balance, H160, Moment } from '@polkadot/types/interfaces/runtime';
import type {AccountId, Balance, H160, Moment} from '@polkadot/types/interfaces/runtime';
import type {AccountInfo} from "@polkadot/types/interfaces/system";

/** @name AttemptsArg */
export interface AttemptsArg extends Struct {
Expand All @@ -22,6 +23,36 @@ export interface BalanceTransferArgs extends ITuple<[AccountId, AccountId, Balan
/** @name BalanceTransferWithNoteArgs */
export interface BalanceTransferWithNoteArgs extends ITuple<[AccountId, AccountId, BalanceType, Text]> {}

/** @name SendNoteArgs */
export interface SendNoteArgs extends ITuple<[AccountId, AccountId, Text]> {}

/** @name AddSessionProxyArgs */
export interface AddSessionProxyArgs extends ITuple<[AccountId, AccountId, SessionProxyCredentials]> {}

/** @name SessionProxyRole */
export interface SessionProxyRole extends Enum {
readonly isReadBalance: boolean;
readonly isReadAny: boolean;
readonly isNonTransfer: boolean;
readonly isAny: boolean;
readonly isTransferAllowance: boolean;
readonly asTransferAllowance: Balance;
readonly type: 'ReadBalance' | 'ReadAny' | 'NonTransfer' | 'Any' | 'TransferAllowance';
}

/** @name SessionProxyCredentials */
export interface SessionProxyCredentials extends Struct {
readonly role: SessionProxyRole;
readonly expiry: Option<Moment>;
readonly seed: Uint8Array;
}

/** @name AccountInfoAndSessionProxies */
export interface AccountInfoAndSessionProxies extends Struct {
readonly account_info: AccountInfo;
readonly session_proxies: Vec<SessionProxyCredentials>;
}

/** @name BalanceUnshieldArgs */
export interface BalanceUnshieldArgs extends ITuple<[AccountId, AccountId, BalanceType, ShardIdentifier]> {}

Expand Down Expand Up @@ -174,7 +205,8 @@ export interface IntegriteeTrustedCall extends Enum {
readonly isUnusedIndex17: boolean;
readonly isUnusedIndex18: boolean;
readonly isUnusedIndex19: boolean;
readonly isUnusedIndex20: boolean;
readonly isSendNote: boolean;
readonly asSendNote: SendNoteArgs;
readonly isUnusedIndex21: boolean;
readonly isUnusedIndex22: boolean;
readonly isUnusedIndex23: boolean;
Expand All @@ -184,7 +216,8 @@ export interface IntegriteeTrustedCall extends Enum {
readonly isUnusedIndex27: boolean;
readonly isUnusedIndex28: boolean;
readonly isUnusedIndex29: boolean;
readonly isUnusedIndex30: boolean;
readonly isAddSessionProxy: boolean;
readonly asAddSessionProxy: AddSessionProxyArgs;
readonly isUnusedIndex31: boolean;
readonly isUnusedIndex32: boolean;
readonly isUnusedIndex33: boolean;
Expand Down Expand Up @@ -213,13 +246,16 @@ export interface IntegriteeTrustedCall extends Enum {
export interface IntegriteeTrustedCallSigned extends Struct {
readonly call: IntegriteeTrustedCall;
readonly nonce: u32;
readonly delegate: Option<AccountId>,
readonly signature: MultiSignature;
}

/** @name IntegriteeTrustedGetter */
export interface IntegriteeTrustedGetter extends Enum {
readonly isAccountInfo: boolean;
readonly asAccountInfo: AccountId;
readonly isAccountInfoAndSessionProxies: boolean;
readonly asAccountInfoAndSessionProxies: AccountId;
readonly isUnusedIndex1: boolean;
readonly isUnusedIndex2: boolean;
readonly isUnusedIndex3: boolean;
Expand Down Expand Up @@ -278,6 +314,7 @@ export interface IntegriteeTrustedGetter extends Enum {
/** @name IntegriteeTrustedGetterSigned */
export interface IntegriteeTrustedGetterSigned extends Struct {
readonly getter: IntegriteeTrustedGetter;
readonly delegate: Option<AccountId>
readonly signature: MultiSignature;
}

Expand Down
3 changes: 2 additions & 1 deletion packages/util/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"engines": {
"node": ">=18.14"
},
"gitHead": "1fa54c11ec73869718b9de521a143969c4cacc02",
"homepage": "https://github.com/encointer/encointer-js/tree/master/packages/util#readme",
"license": "MIT",
"name": "@encointer/util",
Expand All @@ -20,7 +21,7 @@
"sideEffects": false,
"type": "module",
"types": "./index.d.ts",
"version": "0.17.0-alpha.2",
"version": "0.18.0-alpha.3",
"main": "index.js",
"dependencies": {
"@babel/runtime": "^7.18.9",
Expand Down
9 changes: 5 additions & 4 deletions packages/worker-api/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"engines": {
"node": ">=18.14"
},
"gitHead": "1fa54c11ec73869718b9de521a143969c4cacc02",
"homepage": "https://github.com/encointer/encointer-js/tree/master/packages/worker-api#readme",
"license": "GPL-3.0-or-later",
"name": "@encointer/worker-api",
Expand All @@ -19,12 +20,12 @@
"sideEffects": false,
"type": "module",
"types": "./index.d.ts",
"version": "0.17.0-alpha.2",
"version": "0.18.0-alpha.3",
"main": "index.js",
"dependencies": {
"@encointer/node-api": "^0.17.0-alpha.2",
"@encointer/types": "^0.17.0-alpha.2",
"@encointer/util": "^0.17.0-alpha.2",
"@encointer/node-api": "^0.18.0-alpha.3",
"@encointer/types": "^0.18.0-alpha.3",
"@encointer/util": "^0.18.0-alpha.3",
"@peculiar/webcrypto": "^1.4.6",
"@polkadot/api": "^11.2.1",
"@polkadot/keyring": "^12.6.2",
Expand Down
Loading
Loading