forked from cerc-io/registry-sdk
Compare commits
10
Commits
v0.2.2
...
iv-timeout
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5fe6c432de | ||
|
|
37c2f5897f | ||
|
|
225aa2a6aa | ||
|
|
81dbf57fc2 | ||
|
|
a3b78fd363 | ||
|
|
52cab23c70 | ||
|
|
147348cf1d | ||
|
|
5fc42e897a | ||
|
|
3a828b47ae | ||
|
|
022c55268c |
@@ -20,7 +20,7 @@ jobs:
|
|||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v3
|
||||||
with:
|
with:
|
||||||
path: "./laconicd/"
|
path: "./laconicd/"
|
||||||
repository: cerc-io/laconic2d # TODO: Update to laconicd on repo renaming
|
repository: cerc-io/laconicd
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
ref: main
|
ref: main
|
||||||
- name: Environment
|
- name: Environment
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ jobs:
|
|||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v3
|
||||||
with:
|
with:
|
||||||
path: "./laconicd/"
|
path: "./laconicd/"
|
||||||
repository: cerc-io/laconic2d
|
repository: cerc-io/laconicd
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
ref: main
|
ref: main
|
||||||
- name: Environment
|
- name: Environment
|
||||||
|
|||||||
+9
-8
@@ -4,13 +4,14 @@
|
|||||||
|
|
||||||
Run following scripts when [proto files](./proto/) are updated.
|
Run following scripts when [proto files](./proto/) are updated.
|
||||||
|
|
||||||
1. Install dependencies
|
* Install dependencies:
|
||||||
```bash
|
|
||||||
yarn
|
|
||||||
```
|
|
||||||
|
|
||||||
2. Generate typescript code for the proto files
|
```bash
|
||||||
|
yarn
|
||||||
|
```
|
||||||
|
|
||||||
```bash
|
* Generate typescript bindings for the proto files:
|
||||||
./scripts/proto-gen.sh
|
|
||||||
```
|
```bash
|
||||||
|
./scripts/proto-gen.sh
|
||||||
|
```
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ Follow these steps to run the tests:
|
|||||||
cp .env.example .env
|
cp .env.example .env
|
||||||
```
|
```
|
||||||
|
|
||||||
- Clone the [laconicd repo](https://git.vdb.to/cerc-io/laconic2d) and change to repo directory.
|
- Clone the [laconicd repo](https://git.vdb.to/cerc-io/laconicd) and change to repo directory.
|
||||||
|
|
||||||
- Run the chain using `./scripts/init.sh`.
|
- Run the chain using `./scripts/init.sh`.
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@cerc-io/registry-sdk",
|
"name": "@cerc-io/registry-sdk",
|
||||||
"version": "0.2.2",
|
"version": "0.2.6",
|
||||||
"main": "dist/index.js",
|
"main": "dist/index.js",
|
||||||
"types": "dist/index.d.ts",
|
"types": "dist/index.d.ts",
|
||||||
"repository": "git@github.com:cerc-io/registry-sdk.git",
|
"repository": "git@github.com:cerc-io/registry-sdk.git",
|
||||||
|
|||||||
@@ -8,28 +8,36 @@ option go_package = "git.vdb.to/cerc-io/laconicd/x/onboarding";
|
|||||||
|
|
||||||
// Params defines the parameters of the onboarding module.
|
// Params defines the parameters of the onboarding module.
|
||||||
message Params {
|
message Params {
|
||||||
bool onboarding_enabled = 1 [
|
bool onboarding_enabled = 1
|
||||||
(gogoproto.moretags) = "json:\"onboarding_enabled\" yaml:\"onboarding_enabled\""
|
[ (gogoproto.moretags) =
|
||||||
];
|
"json:\"onboarding_enabled\" yaml:\"onboarding_enabled\"" ];
|
||||||
}
|
}
|
||||||
|
|
||||||
// Participant defines the data that will be stored for each enrolled participant
|
// Participant defines the data that will be stored for each enrolled
|
||||||
|
// participant
|
||||||
message Participant {
|
message Participant {
|
||||||
string cosmos_address = 1 [
|
// participant's cosmos (laconic) address
|
||||||
(gogoproto.moretags) = "json:\"cosmos_address\" yaml:\"cosmos_address\""
|
string cosmos_address = 1
|
||||||
];
|
[ (gogoproto.moretags) =
|
||||||
|
"json:\"cosmos_address\" yaml:\"cosmos_address\"" ];
|
||||||
|
|
||||||
string nitro_address = 2 [
|
// participant's Nitro address
|
||||||
(gogoproto.moretags) = "json:\"nitro_address\" yaml:\"nitro_address\""
|
string nitro_address = 2
|
||||||
];
|
[ (gogoproto.moretags) =
|
||||||
|
"json:\"nitro_address\" yaml:\"nitro_address\"" ];
|
||||||
|
|
||||||
|
// participant's role (participant | validator)
|
||||||
|
string role = 3 [ (gogoproto.moretags) = "json:\"role\" yaml:\"role\"" ];
|
||||||
|
|
||||||
|
// participant's KYC receipt ID
|
||||||
|
string kyc_id = 4
|
||||||
|
[ (gogoproto.moretags) = "json:\"kyc_id\" yaml:\"kyc_id\"" ];
|
||||||
}
|
}
|
||||||
|
|
||||||
// EthPayload defines the payload that is signed by the ethereum private key
|
// EthPayload defines the payload that is signed by the ethereum private key
|
||||||
message EthPayload {
|
message EthPayload {
|
||||||
string address = 1 [
|
string address = 1
|
||||||
(gogoproto.moretags) = "json:\"address\" yaml:\"address\""
|
[ (gogoproto.moretags) = "json:\"address\" yaml:\"address\"" ];
|
||||||
];
|
|
||||||
|
|
||||||
string msg = 2 [
|
string msg = 2 [ (gogoproto.moretags) = "json:\"msg\" yaml:\"msg\"" ];
|
||||||
(gogoproto.moretags) = "json:\"msg\" yaml:\"msg\""
|
|
||||||
];
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,9 +12,23 @@ option go_package = "git.vdb.to/cerc-io/laconicd/x/onboarding";
|
|||||||
// Query defines the gRPC querier service for onboarding module
|
// Query defines the gRPC querier service for onboarding module
|
||||||
service Query {
|
service Query {
|
||||||
// Participants queries Participants list
|
// Participants queries Participants list
|
||||||
rpc Participants(QueryParticipantsRequest) returns (QueryParticipantsResponse) {
|
rpc Participants(QueryParticipantsRequest)
|
||||||
|
returns (QueryParticipantsResponse) {
|
||||||
option (google.api.http).get = "/cerc/onboarding/v1/participants";
|
option (google.api.http).get = "/cerc/onboarding/v1/participants";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// GetParticipantByAddress queries a participant by cosmos (laconic) address
|
||||||
|
rpc GetParticipantByAddress(QueryGetParticipantByAddressRequest)
|
||||||
|
returns (QueryGetParticipantByAddressResponse) {
|
||||||
|
option (google.api.http).get = "/cerc/onboarding/v1/participants/{address}";
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetParticipantByNitroAddress queries a participant by nitro address
|
||||||
|
rpc GetParticipantByNitroAddress(QueryGetParticipantByNitroAddressRequest)
|
||||||
|
returns (QueryGetParticipantByNitroAddressResponse) {
|
||||||
|
option (google.api.http).get =
|
||||||
|
"/cerc/onboarding/v1/participants/{nitro_address}";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// QueryParticipantsRequest queries participants
|
// QueryParticipantsRequest queries participants
|
||||||
@@ -23,7 +37,7 @@ message QueryParticipantsRequest {
|
|||||||
cosmos.base.query.v1beta1.PageRequest pagination = 1;
|
cosmos.base.query.v1beta1.PageRequest pagination = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
// QueryParticipantsResponse is response type for get the participants
|
// QueryParticipantsResponse is response type for querying the participants
|
||||||
message QueryParticipantsResponse {
|
message QueryParticipantsResponse {
|
||||||
repeated Participant participants = 1
|
repeated Participant participants = 1
|
||||||
[ (gogoproto.moretags) = "json:\"participants\" yaml:\"participants\"" ];
|
[ (gogoproto.moretags) = "json:\"participants\" yaml:\"participants\"" ];
|
||||||
@@ -31,3 +45,31 @@ message QueryParticipantsResponse {
|
|||||||
// pagination defines the pagination in the response.
|
// pagination defines the pagination in the response.
|
||||||
cosmos.base.query.v1beta1.PageResponse pagination = 2;
|
cosmos.base.query.v1beta1.PageResponse pagination = 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// QueryGetParticipantByAddressRequest queries participant by the laconic
|
||||||
|
// address
|
||||||
|
message QueryGetParticipantByAddressRequest {
|
||||||
|
// Laconic address
|
||||||
|
string address = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
// QueryGetParticipantByAddressResponse is response type for querying
|
||||||
|
// participant by the laconic address
|
||||||
|
message QueryGetParticipantByAddressResponse {
|
||||||
|
// Participant details
|
||||||
|
Participant participant = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
// QueryGetParticipantByNitroAddressRequest queries participant by the nitro
|
||||||
|
// address
|
||||||
|
message QueryGetParticipantByNitroAddressRequest {
|
||||||
|
// Nitro address
|
||||||
|
string nitro_address = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
// QueryGetParticipantByNitroAddressResponse is response type for querying
|
||||||
|
// participant by the nitro address
|
||||||
|
message QueryGetParticipantByNitroAddressResponse {
|
||||||
|
// Participant details
|
||||||
|
Participant participant = 1;
|
||||||
|
}
|
||||||
|
|||||||
@@ -15,9 +15,9 @@ service Msg {
|
|||||||
|
|
||||||
// OnboardParticipant defines a method for enrolling a new validator.
|
// OnboardParticipant defines a method for enrolling a new validator.
|
||||||
rpc OnboardParticipant(MsgOnboardParticipant)
|
rpc OnboardParticipant(MsgOnboardParticipant)
|
||||||
returns (MsgOnboardParticipantResponse) {
|
returns (MsgOnboardParticipantResponse) {
|
||||||
option (google.api.http).post = "/cerc/onboarding/v1/onboard_participant";
|
option (google.api.http).post = "/cerc/onboarding/v1/onboard_participant";
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
// MsgOnboardParticipant defines a SDK message for enrolling a new validator.
|
// MsgOnboardParticipant defines a SDK message for enrolling a new validator.
|
||||||
@@ -28,7 +28,10 @@ message MsgOnboardParticipant {
|
|||||||
string participant = 1;
|
string participant = 1;
|
||||||
EthPayload eth_payload = 2 [ (gogoproto.nullable) = false ];
|
EthPayload eth_payload = 2 [ (gogoproto.nullable) = false ];
|
||||||
string eth_signature = 3;
|
string eth_signature = 3;
|
||||||
|
string role = 4;
|
||||||
|
string kyc_id = 5;
|
||||||
}
|
}
|
||||||
|
|
||||||
// MsgOnboardParticipantResponse defines the Msg/OnboardParticipant response type.
|
// MsgOnboardParticipantResponse defines the Msg/OnboardParticipant response
|
||||||
|
// type.
|
||||||
message MsgOnboardParticipantResponse {}
|
message MsgOnboardParticipantResponse {}
|
||||||
|
|||||||
@@ -58,6 +58,11 @@ service Query {
|
|||||||
returns (QueryGetRegistryModuleBalanceResponse) {
|
returns (QueryGetRegistryModuleBalanceResponse) {
|
||||||
option (google.api.http).get = "/cerc/registry/v1/balance";
|
option (google.api.http).get = "/cerc/registry/v1/balance";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Authorities queries all authorities
|
||||||
|
rpc Authorities(QueryAuthoritiesRequest) returns (QueryAuthoritiesResponse) {
|
||||||
|
option (google.api.http).get = "/cerc/registry/v1/authorities";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// QueryParamsRequest is request type for registry params
|
// QueryParamsRequest is request type for registry params
|
||||||
@@ -152,6 +157,16 @@ message QueryWhoisResponse {
|
|||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// QueryAuthoritiesRequest is request type to get all authorities
|
||||||
|
message QueryAuthoritiesRequest { string owner = 1; }
|
||||||
|
|
||||||
|
// QueryAuthoritiesResponse is response type for authorities request
|
||||||
|
message QueryAuthoritiesResponse {
|
||||||
|
repeated AuthorityEntry authorities = 1 [ (gogoproto.nullable) = false ];
|
||||||
|
// pagination defines the pagination in the response.
|
||||||
|
cosmos.base.query.v1beta1.PageResponse pagination = 2;
|
||||||
|
}
|
||||||
|
|
||||||
// QueryLookupLrnRequest is request type for LookupLrn
|
// QueryLookupLrnRequest is request type for LookupLrn
|
||||||
message QueryLookupLrnRequest { string lrn = 1; }
|
message QueryLookupLrnRequest { string lrn = 1; }
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -115,7 +115,7 @@ if (!process.env.TEST_AUCTIONS_ENABLED) {
|
|||||||
test('skipping auction tests', () => {});
|
test('skipping auction tests', () => {});
|
||||||
} else {
|
} else {
|
||||||
/**
|
/**
|
||||||
Running these tests requires name auctions enabled. In laconic2d repo run:
|
Running these tests requires name auctions enabled. In laconicd repo run:
|
||||||
|
|
||||||
TEST_AUCTION_ENABLED=true ./init.sh
|
TEST_AUCTION_ENABLED=true ./init.sh
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -1 +1 @@
|
|||||||
export const DENOM = 'photon';
|
export const DENOM = 'alnt';
|
||||||
|
|||||||
+24
-1
@@ -389,6 +389,13 @@ export class Registry {
|
|||||||
return this._client.getAuctionsByIds(ids);
|
return this._client.getAuctionsByIds(ids);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* List authorities by owner.
|
||||||
|
*/
|
||||||
|
async getAuthorities (owner?: string, auction = false) {
|
||||||
|
return this._client.getAuthorities(owner, auction);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Lookup authorities by names.
|
* Lookup authorities by names.
|
||||||
*/
|
*/
|
||||||
@@ -440,7 +447,7 @@ export class Registry {
|
|||||||
/**
|
/**
|
||||||
* Onboard participant.
|
* Onboard participant.
|
||||||
*/
|
*/
|
||||||
async onboardParticipant ({ ethPayload, ethSignature }: MessageMsgOnboardParticipant, privateKey: string, fee: StdFee): Promise<MsgOnboardParticipantResponse> {
|
async onboardParticipant ({ ethPayload, ethSignature, role, kycId }: MessageMsgOnboardParticipant, privateKey: string, fee: StdFee): Promise<MsgOnboardParticipantResponse> {
|
||||||
const account = new Account(Buffer.from(privateKey, 'hex'));
|
const account = new Account(Buffer.from(privateKey, 'hex'));
|
||||||
await account.init();
|
await account.init();
|
||||||
const laconicClient = await this.getLaconicClient(account);
|
const laconicClient = await this.getLaconicClient(account);
|
||||||
@@ -449,6 +456,8 @@ export class Registry {
|
|||||||
account.address,
|
account.address,
|
||||||
ethPayload,
|
ethPayload,
|
||||||
ethSignature,
|
ethSignature,
|
||||||
|
role,
|
||||||
|
kycId,
|
||||||
fee
|
fee
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -459,6 +468,20 @@ export class Registry {
|
|||||||
async getParticipants () {
|
async getParticipants () {
|
||||||
return this._client.getParticipants();
|
return this._client.getParticipants();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get participant by cosmos (laconic) address.
|
||||||
|
*/
|
||||||
|
async getParticipantByAddress (address: string) {
|
||||||
|
return this._client.getParticipantByAddress(address);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get participant by nitro address.
|
||||||
|
*/
|
||||||
|
async getParticipantByNitroAddress (nitroAddress: string) {
|
||||||
|
return this._client.getParticipantByNitroAddress(nitroAddress);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export { Account };
|
export { Account };
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ import { MsgOnboardParticipantResponse } from './proto/cerc/onboarding/v1/tx';
|
|||||||
import { bankTypes } from './types/cosmos/bank/message';
|
import { bankTypes } from './types/cosmos/bank/message';
|
||||||
import { EthPayload } from './proto/cerc/onboarding/v1/onboarding';
|
import { EthPayload } from './proto/cerc/onboarding/v1/onboarding';
|
||||||
|
|
||||||
const DEFAULT_WRITE_ERROR = 'Unable to write to laconic2d.';
|
const DEFAULT_WRITE_ERROR = 'Unable to write to laconicd.';
|
||||||
|
|
||||||
export const laconicDefaultRegistryTypes: ReadonlyArray<[string, GeneratedType]> = [
|
export const laconicDefaultRegistryTypes: ReadonlyArray<[string, GeneratedType]> = [
|
||||||
...defaultRegistryTypes,
|
...defaultRegistryTypes,
|
||||||
@@ -394,6 +394,8 @@ export class LaconicClient extends SigningStargateClient {
|
|||||||
signer: string,
|
signer: string,
|
||||||
ethPayload: EthPayload,
|
ethPayload: EthPayload,
|
||||||
ethSignature: string,
|
ethSignature: string,
|
||||||
|
role: string,
|
||||||
|
kycId: string,
|
||||||
fee: StdFee | 'auto' | number,
|
fee: StdFee | 'auto' | number,
|
||||||
memo = ''
|
memo = ''
|
||||||
) {
|
) {
|
||||||
@@ -402,7 +404,9 @@ export class LaconicClient extends SigningStargateClient {
|
|||||||
value: {
|
value: {
|
||||||
participant: signer,
|
participant: signer,
|
||||||
ethPayload,
|
ethPayload,
|
||||||
ethSignature
|
ethSignature,
|
||||||
|
role,
|
||||||
|
kycId
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -60,7 +60,11 @@ const nameserviceExpiryTests = () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
test('Wait for expiry duration', (done) => {
|
test('Wait for expiry duration', (done) => {
|
||||||
setTimeout(done, 60 * 1000);
|
const expiryTime = 60 * 1000;
|
||||||
|
|
||||||
|
// Wait some more time for block to be executed
|
||||||
|
const waitTime = expiryTime + (3 * 1000);
|
||||||
|
setTimeout(done, waitTime);
|
||||||
});
|
});
|
||||||
|
|
||||||
test('Check record expiry time', async () => {
|
test('Check record expiry time', async () => {
|
||||||
@@ -84,7 +88,11 @@ const nameserviceExpiryTests = () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
test('Wait for expiry duration', (done) => {
|
test('Wait for expiry duration', (done) => {
|
||||||
setTimeout(done, 60 * 1000);
|
const expiryTime = 60 * 1000;
|
||||||
|
|
||||||
|
// Wait some more time for block to be executed
|
||||||
|
const waitTime = expiryTime + (3 * 1000);
|
||||||
|
setTimeout(done, waitTime);
|
||||||
});
|
});
|
||||||
|
|
||||||
test('Check record deleted without bond balance', async () => {
|
test('Check record deleted without bond balance', async () => {
|
||||||
@@ -103,7 +111,7 @@ if (!process.env.TEST_NAMESERVICE_EXPIRY) {
|
|||||||
test('skipping nameservice expiry tests', () => {});
|
test('skipping nameservice expiry tests', () => {});
|
||||||
} else {
|
} else {
|
||||||
/**
|
/**
|
||||||
Running these tests requires timers to be set. In laconic2d repo run:
|
Running these tests requires timers to be set. In laconicd repo run:
|
||||||
|
|
||||||
TEST_REGISTRY_EXPIRY=true ./init.sh
|
TEST_REGISTRY_EXPIRY=true ./init.sh
|
||||||
|
|
||||||
|
|||||||
+86
-5
@@ -1,6 +1,8 @@
|
|||||||
import assert from 'assert';
|
import assert from 'assert';
|
||||||
import path from 'path';
|
import path from 'path';
|
||||||
|
|
||||||
|
import { DirectSecp256k1Wallet, AccountData as CosmosAccount } from '@cosmjs/proto-signing';
|
||||||
|
|
||||||
import { Account } from './account';
|
import { Account } from './account';
|
||||||
import { Registry } from './index';
|
import { Registry } from './index';
|
||||||
import { ensureUpdatedConfig, getConfig } from './testing/helper';
|
import { ensureUpdatedConfig, getConfig } from './testing/helper';
|
||||||
@@ -19,6 +21,18 @@ const namingTests = () => {
|
|||||||
let watcher: any;
|
let watcher: any;
|
||||||
let watcherId: string;
|
let watcherId: string;
|
||||||
|
|
||||||
|
let otherAccount1: Account;
|
||||||
|
|
||||||
|
let reservedAuthorities: {
|
||||||
|
name: string;
|
||||||
|
entry: {
|
||||||
|
ownerAddress: string;
|
||||||
|
status: string;
|
||||||
|
};
|
||||||
|
}[] = [];
|
||||||
|
|
||||||
|
let account: CosmosAccount;
|
||||||
|
|
||||||
beforeAll(async () => {
|
beforeAll(async () => {
|
||||||
registry = new Registry(gqlEndpoint, rpcEndpoint, chainId);
|
registry = new Registry(gqlEndpoint, rpcEndpoint, chainId);
|
||||||
|
|
||||||
@@ -39,12 +53,26 @@ const namingTests = () => {
|
|||||||
);
|
);
|
||||||
|
|
||||||
watcherId = result.id;
|
watcherId = result.id;
|
||||||
|
|
||||||
|
const accountWallet = await DirectSecp256k1Wallet.fromKey(Buffer.from(privateKey, 'hex'), 'laconic');
|
||||||
|
[account] = await accountWallet.getAccounts();
|
||||||
|
|
||||||
|
const mnenonic1 = Account.generateMnemonic();
|
||||||
|
otherAccount1 = await Account.generateFromMnemonic(mnenonic1);
|
||||||
|
await otherAccount1.init();
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('Authority tests', () => {
|
describe('Authority tests', () => {
|
||||||
test('Reserve authority.', async () => {
|
test('Reserve authority.', async () => {
|
||||||
const authorityName = `laconic-${Date.now()}`;
|
const authorityName = `laconic-${Date.now()}`;
|
||||||
await registry.reserveAuthority({ name: authorityName }, privateKey, fee);
|
await registry.reserveAuthority({ name: authorityName }, privateKey, fee);
|
||||||
|
reservedAuthorities.push({
|
||||||
|
name: authorityName,
|
||||||
|
entry: {
|
||||||
|
ownerAddress: account.address,
|
||||||
|
status: 'active'
|
||||||
|
}
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('With authority reserved', () => {
|
describe('With authority reserved', () => {
|
||||||
@@ -56,6 +84,13 @@ const namingTests = () => {
|
|||||||
lrn = `lrn://${authorityName}/app/test`;
|
lrn = `lrn://${authorityName}/app/test`;
|
||||||
|
|
||||||
await registry.reserveAuthority({ name: authorityName }, privateKey, fee);
|
await registry.reserveAuthority({ name: authorityName }, privateKey, fee);
|
||||||
|
reservedAuthorities.push({
|
||||||
|
name: authorityName,
|
||||||
|
entry: {
|
||||||
|
ownerAddress: account.address,
|
||||||
|
status: 'active'
|
||||||
|
}
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
test('Lookup authority.', async () => {
|
test('Lookup authority.', async () => {
|
||||||
@@ -80,6 +115,13 @@ const namingTests = () => {
|
|||||||
test('Reserve sub-authority.', async () => {
|
test('Reserve sub-authority.', async () => {
|
||||||
const subAuthority = `echo.${authorityName}`;
|
const subAuthority = `echo.${authorityName}`;
|
||||||
await registry.reserveAuthority({ name: subAuthority }, privateKey, fee);
|
await registry.reserveAuthority({ name: subAuthority }, privateKey, fee);
|
||||||
|
reservedAuthorities.push({
|
||||||
|
name: subAuthority,
|
||||||
|
entry: {
|
||||||
|
ownerAddress: account.address,
|
||||||
|
status: 'active'
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
const [record] = await registry.lookupAuthorities([subAuthority]);
|
const [record] = await registry.lookupAuthorities([subAuthority]);
|
||||||
expect(record).toBeDefined();
|
expect(record).toBeDefined();
|
||||||
@@ -90,18 +132,22 @@ const namingTests = () => {
|
|||||||
|
|
||||||
test('Reserve sub-authority with different owner.', async () => {
|
test('Reserve sub-authority with different owner.', async () => {
|
||||||
// Create another account, send tx to set public key on the account.
|
// Create another account, send tx to set public key on the account.
|
||||||
const mnenonic1 = Account.generateMnemonic();
|
|
||||||
const otherAccount1 = await Account.generateFromMnemonic(mnenonic1);
|
|
||||||
await otherAccount1.init();
|
|
||||||
await registry.sendCoins({ denom: DENOM, amount: '10000', destinationAddress: otherAccount1.address }, privateKey, fee);
|
|
||||||
|
|
||||||
const mnenonic2 = Account.generateMnemonic();
|
const mnenonic2 = Account.generateMnemonic();
|
||||||
const otherAccount2 = await Account.generateFromMnemonic(mnenonic2);
|
const otherAccount2 = await Account.generateFromMnemonic(mnenonic2);
|
||||||
await otherAccount2.init();
|
await otherAccount2.init();
|
||||||
|
|
||||||
|
await registry.sendCoins({ denom: DENOM, amount: '1000000000', destinationAddress: otherAccount1.address }, privateKey, fee);
|
||||||
await registry.sendCoins({ denom: DENOM, amount: '1000', destinationAddress: otherAccount2.address }, otherAccount1.getPrivateKey(), fee);
|
await registry.sendCoins({ denom: DENOM, amount: '1000', destinationAddress: otherAccount2.address }, otherAccount1.getPrivateKey(), fee);
|
||||||
|
|
||||||
const subAuthority = `halo.${authorityName}`;
|
const subAuthority = `halo.${authorityName}`;
|
||||||
await registry.reserveAuthority({ name: subAuthority, owner: otherAccount1.address }, privateKey, fee);
|
await registry.reserveAuthority({ name: subAuthority, owner: otherAccount1.address }, privateKey, fee);
|
||||||
|
reservedAuthorities.push({
|
||||||
|
name: subAuthority,
|
||||||
|
entry: {
|
||||||
|
ownerAddress: otherAccount1.address,
|
||||||
|
status: 'active'
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
const [record] = await registry.lookupAuthorities([subAuthority]);
|
const [record] = await registry.lookupAuthorities([subAuthority]);
|
||||||
expect(record).toBeDefined();
|
expect(record).toBeDefined();
|
||||||
@@ -120,6 +166,41 @@ const namingTests = () => {
|
|||||||
test('Set authority bond', async () => {
|
test('Set authority bond', async () => {
|
||||||
await registry.setAuthorityBond({ name: authorityName, bondId }, privateKey, fee);
|
await registry.setAuthorityBond({ name: authorityName, bondId }, privateKey, fee);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test('List authorities.', async () => {
|
||||||
|
const authorities = await registry.getAuthorities(undefined, true);
|
||||||
|
reservedAuthorities.sort((a, b) => a.name.localeCompare(b.name));
|
||||||
|
const expectedEntryKeys = [
|
||||||
|
'ownerAddress',
|
||||||
|
'ownerPublicKey',
|
||||||
|
'height',
|
||||||
|
'status',
|
||||||
|
'bondId',
|
||||||
|
'expiryTime',
|
||||||
|
'auction'
|
||||||
|
];
|
||||||
|
|
||||||
|
expect(authorities.length).toEqual(4);
|
||||||
|
expectedEntryKeys.forEach(key => {
|
||||||
|
authorities.forEach((authority: any) => {
|
||||||
|
expect(authority.entry).toHaveProperty(key);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
authorities.forEach((authority: any, index: number) => {
|
||||||
|
expect(authority).toHaveProperty('name');
|
||||||
|
expect(authority.entry).toHaveProperty('ownerAddress');
|
||||||
|
expect(authority.entry).toHaveProperty('status');
|
||||||
|
expect(authority).toMatchObject(reservedAuthorities[index]);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
test('List authorities by owner.', async () => {
|
||||||
|
const authorities = await registry.getAuthorities(otherAccount1.address);
|
||||||
|
|
||||||
|
expect(authorities.length).toEqual(1);
|
||||||
|
expect(authorities[0].entry.ownerAddress).toBe(otherAccount1.address);
|
||||||
|
expect(authorities[0].entry.ownerPublicKey).toBe(otherAccount1.encodedPubkey);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
+37
-16
@@ -1,6 +1,6 @@
|
|||||||
import { Wallet } from 'ethers';
|
import { Wallet } from 'ethers';
|
||||||
|
|
||||||
import { DirectSecp256k1Wallet } from '@cosmjs/proto-signing';
|
import { DirectSecp256k1Wallet, AccountData as CosmosAccount } from '@cosmjs/proto-signing';
|
||||||
|
|
||||||
import { Registry, Account } from './index';
|
import { Registry, Account } from './index';
|
||||||
import { getConfig } from './testing/helper';
|
import { getConfig } from './testing/helper';
|
||||||
@@ -10,18 +10,35 @@ const { chainId, rpcEndpoint, gqlEndpoint, privateKey, fee } = getConfig();
|
|||||||
|
|
||||||
jest.setTimeout(90 * 1000);
|
jest.setTimeout(90 * 1000);
|
||||||
|
|
||||||
|
const DUMMY_ROLE = 'validator';
|
||||||
|
const DUMMY_KYC_ID = 'dummyKycId';
|
||||||
|
|
||||||
const onboardingEnabledTests = () => {
|
const onboardingEnabledTests = () => {
|
||||||
let registry: Registry;
|
let registry: Registry;
|
||||||
let ethWallet: Wallet;
|
let ethWallet: Wallet;
|
||||||
|
let cosmosWallet: CosmosAccount;
|
||||||
|
let expectedParticipants: Participant[] = [];
|
||||||
|
|
||||||
beforeAll(async () => {
|
beforeAll(async () => {
|
||||||
registry = new Registry(gqlEndpoint, rpcEndpoint, chainId);
|
registry = new Registry(gqlEndpoint, rpcEndpoint, chainId);
|
||||||
});
|
|
||||||
|
|
||||||
test('Onboard participant.', async () => {
|
|
||||||
const mnemonic = Account.generateMnemonic();
|
const mnemonic = Account.generateMnemonic();
|
||||||
ethWallet = Wallet.fromMnemonic(mnemonic);
|
ethWallet = Wallet.fromMnemonic(mnemonic);
|
||||||
|
|
||||||
|
const accountWallet = await DirectSecp256k1Wallet.fromKey(Buffer.from(privateKey, 'hex'), 'laconic');
|
||||||
|
[cosmosWallet] = await accountWallet.getAccounts();
|
||||||
|
|
||||||
|
expectedParticipants = [
|
||||||
|
{
|
||||||
|
cosmosAddress: cosmosWallet.address,
|
||||||
|
nitroAddress: ethWallet.address,
|
||||||
|
role: DUMMY_ROLE,
|
||||||
|
kycId: DUMMY_KYC_ID
|
||||||
|
}
|
||||||
|
];
|
||||||
|
});
|
||||||
|
|
||||||
|
test('Onboard participant.', async () => {
|
||||||
const ethPayload = {
|
const ethPayload = {
|
||||||
address: ethWallet.address,
|
address: ethWallet.address,
|
||||||
msg: 'Message signed by ethereum private key'
|
msg: 'Message signed by ethereum private key'
|
||||||
@@ -32,24 +49,26 @@ const onboardingEnabledTests = () => {
|
|||||||
|
|
||||||
await registry.onboardParticipant({
|
await registry.onboardParticipant({
|
||||||
ethPayload,
|
ethPayload,
|
||||||
ethSignature
|
ethSignature,
|
||||||
|
role: DUMMY_ROLE,
|
||||||
|
kycId: DUMMY_KYC_ID
|
||||||
}, privateKey, fee);
|
}, privateKey, fee);
|
||||||
});
|
});
|
||||||
|
|
||||||
test('Query participants.', async () => {
|
test('Query participants.', async () => {
|
||||||
const account = new Account(Buffer.from(privateKey, 'hex'));
|
|
||||||
const cosmosAccount = await DirectSecp256k1Wallet.fromKey(account._privateKey, 'laconic');
|
|
||||||
const [cosmosWallet] = await cosmosAccount.getAccounts();
|
|
||||||
|
|
||||||
const expectedParticipants = [
|
|
||||||
{
|
|
||||||
cosmosAddress: cosmosWallet.address,
|
|
||||||
nitroAddress: ethWallet.address
|
|
||||||
}
|
|
||||||
];
|
|
||||||
const participants = await registry.getParticipants();
|
const participants = await registry.getParticipants();
|
||||||
expect(participants).toEqual(expectedParticipants);
|
expect(participants).toEqual(expectedParticipants);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test('Query participant by address.', async () => {
|
||||||
|
const participant = await registry.getParticipantByAddress(cosmosWallet.address);
|
||||||
|
expect(participant).toEqual(expectedParticipants[0]);
|
||||||
|
});
|
||||||
|
|
||||||
|
test('Query participant by Nitro address.', async () => {
|
||||||
|
const participant = await registry.getParticipantByNitroAddress(ethWallet.address);
|
||||||
|
expect(participant).toEqual(expectedParticipants[0]);
|
||||||
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
const onboardingDisabledTests = () => {
|
const onboardingDisabledTests = () => {
|
||||||
@@ -76,7 +95,9 @@ const onboardingDisabledTests = () => {
|
|||||||
try {
|
try {
|
||||||
await registry.onboardParticipant({
|
await registry.onboardParticipant({
|
||||||
ethPayload,
|
ethPayload,
|
||||||
ethSignature
|
ethSignature,
|
||||||
|
role: DUMMY_ROLE,
|
||||||
|
kycId: DUMMY_KYC_ID
|
||||||
}, privateKey, fee);
|
}, privateKey, fee);
|
||||||
} catch (error: any) {
|
} catch (error: any) {
|
||||||
expect(error.toString()).toContain(errorMsg);
|
expect(error.toString()).toContain(errorMsg);
|
||||||
@@ -94,7 +115,7 @@ if (process.env.ONBOARDING_ENABLED !== '1') {
|
|||||||
describe('Onboarding disabled', onboardingDisabledTests);
|
describe('Onboarding disabled', onboardingDisabledTests);
|
||||||
} else {
|
} else {
|
||||||
/**
|
/**
|
||||||
Running this test requires participants onboarding enabled. In laconic2d repo run:
|
Running this test requires participants onboarding enabled. In laconicd repo run:
|
||||||
|
|
||||||
ONBOARDING_ENABLED=true ./init.sh
|
ONBOARDING_ENABLED=true ./init.sh
|
||||||
|
|
||||||
|
|||||||
@@ -9,10 +9,19 @@ export interface Params {
|
|||||||
onboardingEnabled: boolean;
|
onboardingEnabled: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Participant defines the data that will be stored for each enrolled participant */
|
/**
|
||||||
|
* Participant defines the data that will be stored for each enrolled
|
||||||
|
* participant
|
||||||
|
*/
|
||||||
export interface Participant {
|
export interface Participant {
|
||||||
|
/** participant's cosmos (laconic) address */
|
||||||
cosmosAddress: string;
|
cosmosAddress: string;
|
||||||
|
/** participant's Nitro address */
|
||||||
nitroAddress: string;
|
nitroAddress: string;
|
||||||
|
/** participant's role (participant | validator) */
|
||||||
|
role: string;
|
||||||
|
/** participant's KYC receipt ID */
|
||||||
|
kycId: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** EthPayload defines the payload that is signed by the ethereum private key */
|
/** EthPayload defines the payload that is signed by the ethereum private key */
|
||||||
@@ -77,7 +86,7 @@ export const Params = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
function createBaseParticipant(): Participant {
|
function createBaseParticipant(): Participant {
|
||||||
return { cosmosAddress: "", nitroAddress: "" };
|
return { cosmosAddress: "", nitroAddress: "", role: "", kycId: "" };
|
||||||
}
|
}
|
||||||
|
|
||||||
export const Participant = {
|
export const Participant = {
|
||||||
@@ -91,6 +100,12 @@ export const Participant = {
|
|||||||
if (message.nitroAddress !== "") {
|
if (message.nitroAddress !== "") {
|
||||||
writer.uint32(18).string(message.nitroAddress);
|
writer.uint32(18).string(message.nitroAddress);
|
||||||
}
|
}
|
||||||
|
if (message.role !== "") {
|
||||||
|
writer.uint32(26).string(message.role);
|
||||||
|
}
|
||||||
|
if (message.kycId !== "") {
|
||||||
|
writer.uint32(34).string(message.kycId);
|
||||||
|
}
|
||||||
return writer;
|
return writer;
|
||||||
},
|
},
|
||||||
|
|
||||||
@@ -107,6 +122,12 @@ export const Participant = {
|
|||||||
case 2:
|
case 2:
|
||||||
message.nitroAddress = reader.string();
|
message.nitroAddress = reader.string();
|
||||||
break;
|
break;
|
||||||
|
case 3:
|
||||||
|
message.role = reader.string();
|
||||||
|
break;
|
||||||
|
case 4:
|
||||||
|
message.kycId = reader.string();
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
reader.skipType(tag & 7);
|
reader.skipType(tag & 7);
|
||||||
break;
|
break;
|
||||||
@@ -123,6 +144,8 @@ export const Participant = {
|
|||||||
nitroAddress: isSet(object.nitroAddress)
|
nitroAddress: isSet(object.nitroAddress)
|
||||||
? String(object.nitroAddress)
|
? String(object.nitroAddress)
|
||||||
: "",
|
: "",
|
||||||
|
role: isSet(object.role) ? String(object.role) : "",
|
||||||
|
kycId: isSet(object.kycId) ? String(object.kycId) : "",
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
|
||||||
@@ -132,6 +155,8 @@ export const Participant = {
|
|||||||
(obj.cosmosAddress = message.cosmosAddress);
|
(obj.cosmosAddress = message.cosmosAddress);
|
||||||
message.nitroAddress !== undefined &&
|
message.nitroAddress !== undefined &&
|
||||||
(obj.nitroAddress = message.nitroAddress);
|
(obj.nitroAddress = message.nitroAddress);
|
||||||
|
message.role !== undefined && (obj.role = message.role);
|
||||||
|
message.kycId !== undefined && (obj.kycId = message.kycId);
|
||||||
return obj;
|
return obj;
|
||||||
},
|
},
|
||||||
|
|
||||||
@@ -141,6 +166,8 @@ export const Participant = {
|
|||||||
const message = createBaseParticipant();
|
const message = createBaseParticipant();
|
||||||
message.cosmosAddress = object.cosmosAddress ?? "";
|
message.cosmosAddress = object.cosmosAddress ?? "";
|
||||||
message.nitroAddress = object.nitroAddress ?? "";
|
message.nitroAddress = object.nitroAddress ?? "";
|
||||||
|
message.role = object.role ?? "";
|
||||||
|
message.kycId = object.kycId ?? "";
|
||||||
return message;
|
return message;
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -3,8 +3,8 @@ import {
|
|||||||
PageRequest,
|
PageRequest,
|
||||||
PageResponse,
|
PageResponse,
|
||||||
} from "../../../cosmos/base/query/v1beta1/pagination";
|
} from "../../../cosmos/base/query/v1beta1/pagination";
|
||||||
import Long from "long";
|
|
||||||
import { Participant } from "./onboarding";
|
import { Participant } from "./onboarding";
|
||||||
|
import Long from "long";
|
||||||
import _m0 from "protobufjs/minimal";
|
import _m0 from "protobufjs/minimal";
|
||||||
|
|
||||||
export const protobufPackage = "cerc.onboarding.v1";
|
export const protobufPackage = "cerc.onboarding.v1";
|
||||||
@@ -15,13 +15,49 @@ export interface QueryParticipantsRequest {
|
|||||||
pagination?: PageRequest;
|
pagination?: PageRequest;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** QueryParticipantsResponse is response type for get the participants */
|
/** QueryParticipantsResponse is response type for querying the participants */
|
||||||
export interface QueryParticipantsResponse {
|
export interface QueryParticipantsResponse {
|
||||||
participants: Participant[];
|
participants: Participant[];
|
||||||
/** pagination defines the pagination in the response. */
|
/** pagination defines the pagination in the response. */
|
||||||
pagination?: PageResponse;
|
pagination?: PageResponse;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* QueryGetParticipantByAddressRequest queries participant by the laconic
|
||||||
|
* address
|
||||||
|
*/
|
||||||
|
export interface QueryGetParticipantByAddressRequest {
|
||||||
|
/** Laconic address */
|
||||||
|
address: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* QueryGetParticipantByAddressResponse is response type for querying
|
||||||
|
* participant by the laconic address
|
||||||
|
*/
|
||||||
|
export interface QueryGetParticipantByAddressResponse {
|
||||||
|
/** Participant details */
|
||||||
|
participant?: Participant;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* QueryGetParticipantByNitroAddressRequest queries participant by the nitro
|
||||||
|
* address
|
||||||
|
*/
|
||||||
|
export interface QueryGetParticipantByNitroAddressRequest {
|
||||||
|
/** Nitro address */
|
||||||
|
nitroAddress: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* QueryGetParticipantByNitroAddressResponse is response type for querying
|
||||||
|
* participant by the nitro address
|
||||||
|
*/
|
||||||
|
export interface QueryGetParticipantByNitroAddressResponse {
|
||||||
|
/** Participant details */
|
||||||
|
participant?: Participant;
|
||||||
|
}
|
||||||
|
|
||||||
function createBaseQueryParticipantsRequest(): QueryParticipantsRequest {
|
function createBaseQueryParticipantsRequest(): QueryParticipantsRequest {
|
||||||
return { pagination: undefined };
|
return { pagination: undefined };
|
||||||
}
|
}
|
||||||
@@ -175,12 +211,273 @@ export const QueryParticipantsResponse = {
|
|||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
function createBaseQueryGetParticipantByAddressRequest(): QueryGetParticipantByAddressRequest {
|
||||||
|
return { address: "" };
|
||||||
|
}
|
||||||
|
|
||||||
|
export const QueryGetParticipantByAddressRequest = {
|
||||||
|
encode(
|
||||||
|
message: QueryGetParticipantByAddressRequest,
|
||||||
|
writer: _m0.Writer = _m0.Writer.create()
|
||||||
|
): _m0.Writer {
|
||||||
|
if (message.address !== "") {
|
||||||
|
writer.uint32(10).string(message.address);
|
||||||
|
}
|
||||||
|
return writer;
|
||||||
|
},
|
||||||
|
|
||||||
|
decode(
|
||||||
|
input: _m0.Reader | Uint8Array,
|
||||||
|
length?: number
|
||||||
|
): QueryGetParticipantByAddressRequest {
|
||||||
|
const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
|
||||||
|
let end = length === undefined ? reader.len : reader.pos + length;
|
||||||
|
const message = createBaseQueryGetParticipantByAddressRequest();
|
||||||
|
while (reader.pos < end) {
|
||||||
|
const tag = reader.uint32();
|
||||||
|
switch (tag >>> 3) {
|
||||||
|
case 1:
|
||||||
|
message.address = reader.string();
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
reader.skipType(tag & 7);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return message;
|
||||||
|
},
|
||||||
|
|
||||||
|
fromJSON(object: any): QueryGetParticipantByAddressRequest {
|
||||||
|
return {
|
||||||
|
address: isSet(object.address) ? String(object.address) : "",
|
||||||
|
};
|
||||||
|
},
|
||||||
|
|
||||||
|
toJSON(message: QueryGetParticipantByAddressRequest): unknown {
|
||||||
|
const obj: any = {};
|
||||||
|
message.address !== undefined && (obj.address = message.address);
|
||||||
|
return obj;
|
||||||
|
},
|
||||||
|
|
||||||
|
fromPartial<
|
||||||
|
I extends Exact<DeepPartial<QueryGetParticipantByAddressRequest>, I>
|
||||||
|
>(object: I): QueryGetParticipantByAddressRequest {
|
||||||
|
const message = createBaseQueryGetParticipantByAddressRequest();
|
||||||
|
message.address = object.address ?? "";
|
||||||
|
return message;
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
function createBaseQueryGetParticipantByAddressResponse(): QueryGetParticipantByAddressResponse {
|
||||||
|
return { participant: undefined };
|
||||||
|
}
|
||||||
|
|
||||||
|
export const QueryGetParticipantByAddressResponse = {
|
||||||
|
encode(
|
||||||
|
message: QueryGetParticipantByAddressResponse,
|
||||||
|
writer: _m0.Writer = _m0.Writer.create()
|
||||||
|
): _m0.Writer {
|
||||||
|
if (message.participant !== undefined) {
|
||||||
|
Participant.encode(
|
||||||
|
message.participant,
|
||||||
|
writer.uint32(10).fork()
|
||||||
|
).ldelim();
|
||||||
|
}
|
||||||
|
return writer;
|
||||||
|
},
|
||||||
|
|
||||||
|
decode(
|
||||||
|
input: _m0.Reader | Uint8Array,
|
||||||
|
length?: number
|
||||||
|
): QueryGetParticipantByAddressResponse {
|
||||||
|
const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
|
||||||
|
let end = length === undefined ? reader.len : reader.pos + length;
|
||||||
|
const message = createBaseQueryGetParticipantByAddressResponse();
|
||||||
|
while (reader.pos < end) {
|
||||||
|
const tag = reader.uint32();
|
||||||
|
switch (tag >>> 3) {
|
||||||
|
case 1:
|
||||||
|
message.participant = Participant.decode(reader, reader.uint32());
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
reader.skipType(tag & 7);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return message;
|
||||||
|
},
|
||||||
|
|
||||||
|
fromJSON(object: any): QueryGetParticipantByAddressResponse {
|
||||||
|
return {
|
||||||
|
participant: isSet(object.participant)
|
||||||
|
? Participant.fromJSON(object.participant)
|
||||||
|
: undefined,
|
||||||
|
};
|
||||||
|
},
|
||||||
|
|
||||||
|
toJSON(message: QueryGetParticipantByAddressResponse): unknown {
|
||||||
|
const obj: any = {};
|
||||||
|
message.participant !== undefined &&
|
||||||
|
(obj.participant = message.participant
|
||||||
|
? Participant.toJSON(message.participant)
|
||||||
|
: undefined);
|
||||||
|
return obj;
|
||||||
|
},
|
||||||
|
|
||||||
|
fromPartial<
|
||||||
|
I extends Exact<DeepPartial<QueryGetParticipantByAddressResponse>, I>
|
||||||
|
>(object: I): QueryGetParticipantByAddressResponse {
|
||||||
|
const message = createBaseQueryGetParticipantByAddressResponse();
|
||||||
|
message.participant =
|
||||||
|
object.participant !== undefined && object.participant !== null
|
||||||
|
? Participant.fromPartial(object.participant)
|
||||||
|
: undefined;
|
||||||
|
return message;
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
function createBaseQueryGetParticipantByNitroAddressRequest(): QueryGetParticipantByNitroAddressRequest {
|
||||||
|
return { nitroAddress: "" };
|
||||||
|
}
|
||||||
|
|
||||||
|
export const QueryGetParticipantByNitroAddressRequest = {
|
||||||
|
encode(
|
||||||
|
message: QueryGetParticipantByNitroAddressRequest,
|
||||||
|
writer: _m0.Writer = _m0.Writer.create()
|
||||||
|
): _m0.Writer {
|
||||||
|
if (message.nitroAddress !== "") {
|
||||||
|
writer.uint32(10).string(message.nitroAddress);
|
||||||
|
}
|
||||||
|
return writer;
|
||||||
|
},
|
||||||
|
|
||||||
|
decode(
|
||||||
|
input: _m0.Reader | Uint8Array,
|
||||||
|
length?: number
|
||||||
|
): QueryGetParticipantByNitroAddressRequest {
|
||||||
|
const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
|
||||||
|
let end = length === undefined ? reader.len : reader.pos + length;
|
||||||
|
const message = createBaseQueryGetParticipantByNitroAddressRequest();
|
||||||
|
while (reader.pos < end) {
|
||||||
|
const tag = reader.uint32();
|
||||||
|
switch (tag >>> 3) {
|
||||||
|
case 1:
|
||||||
|
message.nitroAddress = reader.string();
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
reader.skipType(tag & 7);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return message;
|
||||||
|
},
|
||||||
|
|
||||||
|
fromJSON(object: any): QueryGetParticipantByNitroAddressRequest {
|
||||||
|
return {
|
||||||
|
nitroAddress: isSet(object.nitroAddress)
|
||||||
|
? String(object.nitroAddress)
|
||||||
|
: "",
|
||||||
|
};
|
||||||
|
},
|
||||||
|
|
||||||
|
toJSON(message: QueryGetParticipantByNitroAddressRequest): unknown {
|
||||||
|
const obj: any = {};
|
||||||
|
message.nitroAddress !== undefined &&
|
||||||
|
(obj.nitroAddress = message.nitroAddress);
|
||||||
|
return obj;
|
||||||
|
},
|
||||||
|
|
||||||
|
fromPartial<
|
||||||
|
I extends Exact<DeepPartial<QueryGetParticipantByNitroAddressRequest>, I>
|
||||||
|
>(object: I): QueryGetParticipantByNitroAddressRequest {
|
||||||
|
const message = createBaseQueryGetParticipantByNitroAddressRequest();
|
||||||
|
message.nitroAddress = object.nitroAddress ?? "";
|
||||||
|
return message;
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
function createBaseQueryGetParticipantByNitroAddressResponse(): QueryGetParticipantByNitroAddressResponse {
|
||||||
|
return { participant: undefined };
|
||||||
|
}
|
||||||
|
|
||||||
|
export const QueryGetParticipantByNitroAddressResponse = {
|
||||||
|
encode(
|
||||||
|
message: QueryGetParticipantByNitroAddressResponse,
|
||||||
|
writer: _m0.Writer = _m0.Writer.create()
|
||||||
|
): _m0.Writer {
|
||||||
|
if (message.participant !== undefined) {
|
||||||
|
Participant.encode(
|
||||||
|
message.participant,
|
||||||
|
writer.uint32(10).fork()
|
||||||
|
).ldelim();
|
||||||
|
}
|
||||||
|
return writer;
|
||||||
|
},
|
||||||
|
|
||||||
|
decode(
|
||||||
|
input: _m0.Reader | Uint8Array,
|
||||||
|
length?: number
|
||||||
|
): QueryGetParticipantByNitroAddressResponse {
|
||||||
|
const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
|
||||||
|
let end = length === undefined ? reader.len : reader.pos + length;
|
||||||
|
const message = createBaseQueryGetParticipantByNitroAddressResponse();
|
||||||
|
while (reader.pos < end) {
|
||||||
|
const tag = reader.uint32();
|
||||||
|
switch (tag >>> 3) {
|
||||||
|
case 1:
|
||||||
|
message.participant = Participant.decode(reader, reader.uint32());
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
reader.skipType(tag & 7);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return message;
|
||||||
|
},
|
||||||
|
|
||||||
|
fromJSON(object: any): QueryGetParticipantByNitroAddressResponse {
|
||||||
|
return {
|
||||||
|
participant: isSet(object.participant)
|
||||||
|
? Participant.fromJSON(object.participant)
|
||||||
|
: undefined,
|
||||||
|
};
|
||||||
|
},
|
||||||
|
|
||||||
|
toJSON(message: QueryGetParticipantByNitroAddressResponse): unknown {
|
||||||
|
const obj: any = {};
|
||||||
|
message.participant !== undefined &&
|
||||||
|
(obj.participant = message.participant
|
||||||
|
? Participant.toJSON(message.participant)
|
||||||
|
: undefined);
|
||||||
|
return obj;
|
||||||
|
},
|
||||||
|
|
||||||
|
fromPartial<
|
||||||
|
I extends Exact<DeepPartial<QueryGetParticipantByNitroAddressResponse>, I>
|
||||||
|
>(object: I): QueryGetParticipantByNitroAddressResponse {
|
||||||
|
const message = createBaseQueryGetParticipantByNitroAddressResponse();
|
||||||
|
message.participant =
|
||||||
|
object.participant !== undefined && object.participant !== null
|
||||||
|
? Participant.fromPartial(object.participant)
|
||||||
|
: undefined;
|
||||||
|
return message;
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
/** Query defines the gRPC querier service for onboarding module */
|
/** Query defines the gRPC querier service for onboarding module */
|
||||||
export interface Query {
|
export interface Query {
|
||||||
/** Participants queries Participants list */
|
/** Participants queries Participants list */
|
||||||
Participants(
|
Participants(
|
||||||
request: QueryParticipantsRequest
|
request: QueryParticipantsRequest
|
||||||
): Promise<QueryParticipantsResponse>;
|
): Promise<QueryParticipantsResponse>;
|
||||||
|
/** GetParticipantByAddress queries a participant by cosmos (laconic) address */
|
||||||
|
GetParticipantByAddress(
|
||||||
|
request: QueryGetParticipantByAddressRequest
|
||||||
|
): Promise<QueryGetParticipantByAddressResponse>;
|
||||||
|
/** GetParticipantByNitroAddress queries a participant by nitro address */
|
||||||
|
GetParticipantByNitroAddress(
|
||||||
|
request: QueryGetParticipantByNitroAddressRequest
|
||||||
|
): Promise<QueryGetParticipantByNitroAddressResponse>;
|
||||||
}
|
}
|
||||||
|
|
||||||
export class QueryClientImpl implements Query {
|
export class QueryClientImpl implements Query {
|
||||||
@@ -188,6 +485,9 @@ export class QueryClientImpl implements Query {
|
|||||||
constructor(rpc: Rpc) {
|
constructor(rpc: Rpc) {
|
||||||
this.rpc = rpc;
|
this.rpc = rpc;
|
||||||
this.Participants = this.Participants.bind(this);
|
this.Participants = this.Participants.bind(this);
|
||||||
|
this.GetParticipantByAddress = this.GetParticipantByAddress.bind(this);
|
||||||
|
this.GetParticipantByNitroAddress =
|
||||||
|
this.GetParticipantByNitroAddress.bind(this);
|
||||||
}
|
}
|
||||||
Participants(
|
Participants(
|
||||||
request: QueryParticipantsRequest
|
request: QueryParticipantsRequest
|
||||||
@@ -202,6 +502,35 @@ export class QueryClientImpl implements Query {
|
|||||||
QueryParticipantsResponse.decode(new _m0.Reader(data))
|
QueryParticipantsResponse.decode(new _m0.Reader(data))
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
GetParticipantByAddress(
|
||||||
|
request: QueryGetParticipantByAddressRequest
|
||||||
|
): Promise<QueryGetParticipantByAddressResponse> {
|
||||||
|
const data = QueryGetParticipantByAddressRequest.encode(request).finish();
|
||||||
|
const promise = this.rpc.request(
|
||||||
|
"cerc.onboarding.v1.Query",
|
||||||
|
"GetParticipantByAddress",
|
||||||
|
data
|
||||||
|
);
|
||||||
|
return promise.then((data) =>
|
||||||
|
QueryGetParticipantByAddressResponse.decode(new _m0.Reader(data))
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
GetParticipantByNitroAddress(
|
||||||
|
request: QueryGetParticipantByNitroAddressRequest
|
||||||
|
): Promise<QueryGetParticipantByNitroAddressResponse> {
|
||||||
|
const data =
|
||||||
|
QueryGetParticipantByNitroAddressRequest.encode(request).finish();
|
||||||
|
const promise = this.rpc.request(
|
||||||
|
"cerc.onboarding.v1.Query",
|
||||||
|
"GetParticipantByNitroAddress",
|
||||||
|
data
|
||||||
|
);
|
||||||
|
return promise.then((data) =>
|
||||||
|
QueryGetParticipantByNitroAddressResponse.decode(new _m0.Reader(data))
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
interface Rpc {
|
interface Rpc {
|
||||||
|
|||||||
@@ -11,13 +11,24 @@ export interface MsgOnboardParticipant {
|
|||||||
participant: string;
|
participant: string;
|
||||||
ethPayload?: EthPayload;
|
ethPayload?: EthPayload;
|
||||||
ethSignature: string;
|
ethSignature: string;
|
||||||
|
role: string;
|
||||||
|
kycId: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** MsgOnboardParticipantResponse defines the Msg/OnboardParticipant response type. */
|
/**
|
||||||
|
* MsgOnboardParticipantResponse defines the Msg/OnboardParticipant response
|
||||||
|
* type.
|
||||||
|
*/
|
||||||
export interface MsgOnboardParticipantResponse {}
|
export interface MsgOnboardParticipantResponse {}
|
||||||
|
|
||||||
function createBaseMsgOnboardParticipant(): MsgOnboardParticipant {
|
function createBaseMsgOnboardParticipant(): MsgOnboardParticipant {
|
||||||
return { participant: "", ethPayload: undefined, ethSignature: "" };
|
return {
|
||||||
|
participant: "",
|
||||||
|
ethPayload: undefined,
|
||||||
|
ethSignature: "",
|
||||||
|
role: "",
|
||||||
|
kycId: "",
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
export const MsgOnboardParticipant = {
|
export const MsgOnboardParticipant = {
|
||||||
@@ -34,6 +45,12 @@ export const MsgOnboardParticipant = {
|
|||||||
if (message.ethSignature !== "") {
|
if (message.ethSignature !== "") {
|
||||||
writer.uint32(26).string(message.ethSignature);
|
writer.uint32(26).string(message.ethSignature);
|
||||||
}
|
}
|
||||||
|
if (message.role !== "") {
|
||||||
|
writer.uint32(34).string(message.role);
|
||||||
|
}
|
||||||
|
if (message.kycId !== "") {
|
||||||
|
writer.uint32(42).string(message.kycId);
|
||||||
|
}
|
||||||
return writer;
|
return writer;
|
||||||
},
|
},
|
||||||
|
|
||||||
@@ -56,6 +73,12 @@ export const MsgOnboardParticipant = {
|
|||||||
case 3:
|
case 3:
|
||||||
message.ethSignature = reader.string();
|
message.ethSignature = reader.string();
|
||||||
break;
|
break;
|
||||||
|
case 4:
|
||||||
|
message.role = reader.string();
|
||||||
|
break;
|
||||||
|
case 5:
|
||||||
|
message.kycId = reader.string();
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
reader.skipType(tag & 7);
|
reader.skipType(tag & 7);
|
||||||
break;
|
break;
|
||||||
@@ -73,6 +96,8 @@ export const MsgOnboardParticipant = {
|
|||||||
ethSignature: isSet(object.ethSignature)
|
ethSignature: isSet(object.ethSignature)
|
||||||
? String(object.ethSignature)
|
? String(object.ethSignature)
|
||||||
: "",
|
: "",
|
||||||
|
role: isSet(object.role) ? String(object.role) : "",
|
||||||
|
kycId: isSet(object.kycId) ? String(object.kycId) : "",
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
|
||||||
@@ -86,6 +111,8 @@ export const MsgOnboardParticipant = {
|
|||||||
: undefined);
|
: undefined);
|
||||||
message.ethSignature !== undefined &&
|
message.ethSignature !== undefined &&
|
||||||
(obj.ethSignature = message.ethSignature);
|
(obj.ethSignature = message.ethSignature);
|
||||||
|
message.role !== undefined && (obj.role = message.role);
|
||||||
|
message.kycId !== undefined && (obj.kycId = message.kycId);
|
||||||
return obj;
|
return obj;
|
||||||
},
|
},
|
||||||
|
|
||||||
@@ -99,6 +126,8 @@ export const MsgOnboardParticipant = {
|
|||||||
? EthPayload.fromPartial(object.ethPayload)
|
? EthPayload.fromPartial(object.ethPayload)
|
||||||
: undefined;
|
: undefined;
|
||||||
message.ethSignature = object.ethSignature ?? "";
|
message.ethSignature = object.ethSignature ?? "";
|
||||||
|
message.role = object.role ?? "";
|
||||||
|
message.kycId = object.kycId ?? "";
|
||||||
return message;
|
return message;
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import {
|
|||||||
NameAuthority,
|
NameAuthority,
|
||||||
NameRecord,
|
NameRecord,
|
||||||
NameEntry,
|
NameEntry,
|
||||||
|
AuthorityEntry,
|
||||||
} from "./registry";
|
} from "./registry";
|
||||||
import {
|
import {
|
||||||
PageRequest,
|
PageRequest,
|
||||||
@@ -118,6 +119,18 @@ export interface QueryWhoisResponse {
|
|||||||
nameAuthority?: NameAuthority;
|
nameAuthority?: NameAuthority;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** QueryAuthoritiesRequest is request type to get all authorities */
|
||||||
|
export interface QueryAuthoritiesRequest {
|
||||||
|
owner: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** QueryAuthoritiesResponse is response type for authorities request */
|
||||||
|
export interface QueryAuthoritiesResponse {
|
||||||
|
authorities: AuthorityEntry[];
|
||||||
|
/** pagination defines the pagination in the response. */
|
||||||
|
pagination?: PageResponse;
|
||||||
|
}
|
||||||
|
|
||||||
/** QueryLookupLrnRequest is request type for LookupLrn */
|
/** QueryLookupLrnRequest is request type for LookupLrn */
|
||||||
export interface QueryLookupLrnRequest {
|
export interface QueryLookupLrnRequest {
|
||||||
lrn: string;
|
lrn: string;
|
||||||
@@ -1460,6 +1473,151 @@ export const QueryWhoisResponse = {
|
|||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
function createBaseQueryAuthoritiesRequest(): QueryAuthoritiesRequest {
|
||||||
|
return { owner: "" };
|
||||||
|
}
|
||||||
|
|
||||||
|
export const QueryAuthoritiesRequest = {
|
||||||
|
encode(
|
||||||
|
message: QueryAuthoritiesRequest,
|
||||||
|
writer: _m0.Writer = _m0.Writer.create()
|
||||||
|
): _m0.Writer {
|
||||||
|
if (message.owner !== "") {
|
||||||
|
writer.uint32(10).string(message.owner);
|
||||||
|
}
|
||||||
|
return writer;
|
||||||
|
},
|
||||||
|
|
||||||
|
decode(
|
||||||
|
input: _m0.Reader | Uint8Array,
|
||||||
|
length?: number
|
||||||
|
): QueryAuthoritiesRequest {
|
||||||
|
const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
|
||||||
|
let end = length === undefined ? reader.len : reader.pos + length;
|
||||||
|
const message = createBaseQueryAuthoritiesRequest();
|
||||||
|
while (reader.pos < end) {
|
||||||
|
const tag = reader.uint32();
|
||||||
|
switch (tag >>> 3) {
|
||||||
|
case 1:
|
||||||
|
message.owner = reader.string();
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
reader.skipType(tag & 7);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return message;
|
||||||
|
},
|
||||||
|
|
||||||
|
fromJSON(object: any): QueryAuthoritiesRequest {
|
||||||
|
return {
|
||||||
|
owner: isSet(object.owner) ? String(object.owner) : "",
|
||||||
|
};
|
||||||
|
},
|
||||||
|
|
||||||
|
toJSON(message: QueryAuthoritiesRequest): unknown {
|
||||||
|
const obj: any = {};
|
||||||
|
message.owner !== undefined && (obj.owner = message.owner);
|
||||||
|
return obj;
|
||||||
|
},
|
||||||
|
|
||||||
|
fromPartial<I extends Exact<DeepPartial<QueryAuthoritiesRequest>, I>>(
|
||||||
|
object: I
|
||||||
|
): QueryAuthoritiesRequest {
|
||||||
|
const message = createBaseQueryAuthoritiesRequest();
|
||||||
|
message.owner = object.owner ?? "";
|
||||||
|
return message;
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
function createBaseQueryAuthoritiesResponse(): QueryAuthoritiesResponse {
|
||||||
|
return { authorities: [], pagination: undefined };
|
||||||
|
}
|
||||||
|
|
||||||
|
export const QueryAuthoritiesResponse = {
|
||||||
|
encode(
|
||||||
|
message: QueryAuthoritiesResponse,
|
||||||
|
writer: _m0.Writer = _m0.Writer.create()
|
||||||
|
): _m0.Writer {
|
||||||
|
for (const v of message.authorities) {
|
||||||
|
AuthorityEntry.encode(v!, writer.uint32(10).fork()).ldelim();
|
||||||
|
}
|
||||||
|
if (message.pagination !== undefined) {
|
||||||
|
PageResponse.encode(
|
||||||
|
message.pagination,
|
||||||
|
writer.uint32(18).fork()
|
||||||
|
).ldelim();
|
||||||
|
}
|
||||||
|
return writer;
|
||||||
|
},
|
||||||
|
|
||||||
|
decode(
|
||||||
|
input: _m0.Reader | Uint8Array,
|
||||||
|
length?: number
|
||||||
|
): QueryAuthoritiesResponse {
|
||||||
|
const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
|
||||||
|
let end = length === undefined ? reader.len : reader.pos + length;
|
||||||
|
const message = createBaseQueryAuthoritiesResponse();
|
||||||
|
while (reader.pos < end) {
|
||||||
|
const tag = reader.uint32();
|
||||||
|
switch (tag >>> 3) {
|
||||||
|
case 1:
|
||||||
|
message.authorities.push(
|
||||||
|
AuthorityEntry.decode(reader, reader.uint32())
|
||||||
|
);
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
message.pagination = PageResponse.decode(reader, reader.uint32());
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
reader.skipType(tag & 7);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return message;
|
||||||
|
},
|
||||||
|
|
||||||
|
fromJSON(object: any): QueryAuthoritiesResponse {
|
||||||
|
return {
|
||||||
|
authorities: Array.isArray(object?.authorities)
|
||||||
|
? object.authorities.map((e: any) => AuthorityEntry.fromJSON(e))
|
||||||
|
: [],
|
||||||
|
pagination: isSet(object.pagination)
|
||||||
|
? PageResponse.fromJSON(object.pagination)
|
||||||
|
: undefined,
|
||||||
|
};
|
||||||
|
},
|
||||||
|
|
||||||
|
toJSON(message: QueryAuthoritiesResponse): unknown {
|
||||||
|
const obj: any = {};
|
||||||
|
if (message.authorities) {
|
||||||
|
obj.authorities = message.authorities.map((e) =>
|
||||||
|
e ? AuthorityEntry.toJSON(e) : undefined
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
obj.authorities = [];
|
||||||
|
}
|
||||||
|
message.pagination !== undefined &&
|
||||||
|
(obj.pagination = message.pagination
|
||||||
|
? PageResponse.toJSON(message.pagination)
|
||||||
|
: undefined);
|
||||||
|
return obj;
|
||||||
|
},
|
||||||
|
|
||||||
|
fromPartial<I extends Exact<DeepPartial<QueryAuthoritiesResponse>, I>>(
|
||||||
|
object: I
|
||||||
|
): QueryAuthoritiesResponse {
|
||||||
|
const message = createBaseQueryAuthoritiesResponse();
|
||||||
|
message.authorities =
|
||||||
|
object.authorities?.map((e) => AuthorityEntry.fromPartial(e)) || [];
|
||||||
|
message.pagination =
|
||||||
|
object.pagination !== undefined && object.pagination !== null
|
||||||
|
? PageResponse.fromPartial(object.pagination)
|
||||||
|
: undefined;
|
||||||
|
return message;
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
function createBaseQueryLookupLrnRequest(): QueryLookupLrnRequest {
|
function createBaseQueryLookupLrnRequest(): QueryLookupLrnRequest {
|
||||||
return { lrn: "" };
|
return { lrn: "" };
|
||||||
}
|
}
|
||||||
@@ -1907,6 +2065,10 @@ export interface Query {
|
|||||||
GetRegistryModuleBalance(
|
GetRegistryModuleBalance(
|
||||||
request: QueryGetRegistryModuleBalanceRequest
|
request: QueryGetRegistryModuleBalanceRequest
|
||||||
): Promise<QueryGetRegistryModuleBalanceResponse>;
|
): Promise<QueryGetRegistryModuleBalanceResponse>;
|
||||||
|
/** Authorities queries all authorities */
|
||||||
|
Authorities(
|
||||||
|
request: QueryAuthoritiesRequest
|
||||||
|
): Promise<QueryAuthoritiesResponse>;
|
||||||
}
|
}
|
||||||
|
|
||||||
export class QueryClientImpl implements Query {
|
export class QueryClientImpl implements Query {
|
||||||
@@ -1922,6 +2084,7 @@ export class QueryClientImpl implements Query {
|
|||||||
this.LookupLrn = this.LookupLrn.bind(this);
|
this.LookupLrn = this.LookupLrn.bind(this);
|
||||||
this.ResolveLrn = this.ResolveLrn.bind(this);
|
this.ResolveLrn = this.ResolveLrn.bind(this);
|
||||||
this.GetRegistryModuleBalance = this.GetRegistryModuleBalance.bind(this);
|
this.GetRegistryModuleBalance = this.GetRegistryModuleBalance.bind(this);
|
||||||
|
this.Authorities = this.Authorities.bind(this);
|
||||||
}
|
}
|
||||||
Params(request: QueryParamsRequest): Promise<QueryParamsResponse> {
|
Params(request: QueryParamsRequest): Promise<QueryParamsResponse> {
|
||||||
const data = QueryParamsRequest.encode(request).finish();
|
const data = QueryParamsRequest.encode(request).finish();
|
||||||
@@ -2026,6 +2189,20 @@ export class QueryClientImpl implements Query {
|
|||||||
QueryGetRegistryModuleBalanceResponse.decode(new _m0.Reader(data))
|
QueryGetRegistryModuleBalanceResponse.decode(new _m0.Reader(data))
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Authorities(
|
||||||
|
request: QueryAuthoritiesRequest
|
||||||
|
): Promise<QueryAuthoritiesResponse> {
|
||||||
|
const data = QueryAuthoritiesRequest.encode(request).finish();
|
||||||
|
const promise = this.rpc.request(
|
||||||
|
"cerc.registry.v1.Query",
|
||||||
|
"Authorities",
|
||||||
|
data
|
||||||
|
);
|
||||||
|
return promise.then((data) =>
|
||||||
|
QueryAuthoritiesResponse.decode(new _m0.Reader(data))
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
interface Rpc {
|
interface Rpc {
|
||||||
|
|||||||
@@ -270,6 +270,34 @@ export class RegistryClient {
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* List authorities by owner.
|
||||||
|
*/
|
||||||
|
async getAuthorities (owner?: string, auction = false) {
|
||||||
|
const query = `query ($owner: String) {
|
||||||
|
getAuthorities(owner: $owner) {
|
||||||
|
name
|
||||||
|
entry {
|
||||||
|
ownerAddress
|
||||||
|
ownerPublicKey
|
||||||
|
height
|
||||||
|
status
|
||||||
|
bondId
|
||||||
|
expiryTime
|
||||||
|
${auction ? ('auction { ' + auctionFields + ' }') : ''}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}`;
|
||||||
|
|
||||||
|
const variables = {
|
||||||
|
owner
|
||||||
|
};
|
||||||
|
|
||||||
|
const result = await this._graph(query)(variables);
|
||||||
|
|
||||||
|
return result.getAuthorities;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Lookup authorities by names.
|
* Lookup authorities by names.
|
||||||
*/
|
*/
|
||||||
@@ -426,6 +454,8 @@ export class RegistryClient {
|
|||||||
getParticipants {
|
getParticipants {
|
||||||
cosmosAddress
|
cosmosAddress
|
||||||
nitroAddress
|
nitroAddress
|
||||||
|
role
|
||||||
|
kycId
|
||||||
}
|
}
|
||||||
}`;
|
}`;
|
||||||
|
|
||||||
@@ -433,4 +463,44 @@ export class RegistryClient {
|
|||||||
|
|
||||||
return RegistryClient.getResult(this._graph(query)(variables), 'getParticipants');
|
return RegistryClient.getResult(this._graph(query)(variables), 'getParticipants');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get participant by cosmos address.
|
||||||
|
*/
|
||||||
|
async getParticipantByAddress (address: string) {
|
||||||
|
const query = `query ($address: String!) {
|
||||||
|
getParticipantByAddress (address: $address) {
|
||||||
|
cosmosAddress
|
||||||
|
nitroAddress
|
||||||
|
role
|
||||||
|
kycId
|
||||||
|
}
|
||||||
|
}`;
|
||||||
|
|
||||||
|
const variables = {
|
||||||
|
address
|
||||||
|
};
|
||||||
|
|
||||||
|
return RegistryClient.getResult(this._graph(query)(variables), 'getParticipantByAddress');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get participant by nitro address.
|
||||||
|
*/
|
||||||
|
async getParticipantByNitroAddress (nitroAddress: string) {
|
||||||
|
const query = `query ($nitroAddress: String!) {
|
||||||
|
getParticipantByNitroAddress (nitroAddress: $nitroAddress) {
|
||||||
|
cosmosAddress
|
||||||
|
nitroAddress
|
||||||
|
role
|
||||||
|
kycId
|
||||||
|
}
|
||||||
|
}`;
|
||||||
|
|
||||||
|
const variables = {
|
||||||
|
nitroAddress
|
||||||
|
};
|
||||||
|
|
||||||
|
return RegistryClient.getResult(this._graph(query)(variables), 'getParticipantByNitroAddress');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ export const getConfig = () => {
|
|||||||
rpcEndpoint: process.env.LACONICD_RPC_ENDPOINT || 'http://localhost:26657',
|
rpcEndpoint: process.env.LACONICD_RPC_ENDPOINT || 'http://localhost:26657',
|
||||||
gqlEndpoint: process.env.LACONICD_GQL_ENDPOINT || 'http://localhost:9473/api',
|
gqlEndpoint: process.env.LACONICD_GQL_ENDPOINT || 'http://localhost:9473/api',
|
||||||
fee: {
|
fee: {
|
||||||
amount: [{ denom: 'photon', amount: '40' }],
|
amount: [{ denom: 'alnt', amount: '400000' }],
|
||||||
gas: '400000'
|
gas: '400000'
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ export const onboardingTypes: ReadonlyArray<[string, GeneratedType]> = [
|
|||||||
|
|
||||||
export interface MsgOnboardParticipantEncodeObject extends EncodeObject {
|
export interface MsgOnboardParticipantEncodeObject extends EncodeObject {
|
||||||
readonly typeUrl: '/cerc.onboarding.v1.MsgOnboardParticipant';
|
readonly typeUrl: '/cerc.onboarding.v1.MsgOnboardParticipant';
|
||||||
readonly value: Partial<MsgOnboardParticipant>;
|
readonly value: MsgOnboardParticipant;
|
||||||
}
|
}
|
||||||
|
|
||||||
interface ethPayload {
|
interface ethPayload {
|
||||||
@@ -23,4 +23,6 @@ interface ethPayload {
|
|||||||
export interface MessageMsgOnboardParticipant {
|
export interface MessageMsgOnboardParticipant {
|
||||||
ethPayload: ethPayload
|
ethPayload: ethPayload
|
||||||
ethSignature: string
|
ethSignature: string
|
||||||
|
role: string
|
||||||
|
kycId: string
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user