Skip to content

Commit

Permalink
Rename "operator" to "signer" in FireFly calls
Browse files Browse the repository at this point in the history
Signed-off-by: Andrew Richardson <andrew.richardson@kaleido.io>
  • Loading branch information
awrichar committed Mar 1, 2022
1 parent a35b821 commit b5677c0
Show file tree
Hide file tree
Showing 6 changed files with 44 additions and 44 deletions.
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,10 @@ not require any acknowledgment).
Successful POST operations will also result in a detailed event corresponding to the type of
transaction that was performed. The events and corresponding data items are:

* `token-pool` - Token pool created (outputs: poolId, operator, data)
* `token-mint` - Tokens minted (outputs: id, poolId, tokenIndex, operator, to, amount, data)
* `token-burn` - Tokens burned (outputs: id, poolId, tokenIndex, operator, from, amount, data)
* `token-transfer` - Tokens transferred (outputs: id, poolId, operator, from, to, amount, data)
* `token-pool` - Token pool created (outputs: poolId, signer, data)
* `token-mint` - Tokens minted (outputs: id, poolId, tokenIndex, signer, to, amount, data)
* `token-burn` - Tokens burned (outputs: id, poolId, tokenIndex, signer, from, amount, data)
* `token-transfer` - Tokens transferred (outputs: id, poolId, signer, from, to, amount, data)

If multiple websocket clients are connected, only one will receive these events.
Each one of these _must_ be acknowledged by replying on the websocket with `{event: "ack", data: {id}}`.
Expand Down
6 changes: 3 additions & 3 deletions src/tokens/tokens.interfaces.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ export class TokenPool {

@ApiProperty()
@IsNotEmpty()
operator: string;
signer: string;

@ApiProperty()
@IsNotEmpty()
Expand Down Expand Up @@ -156,7 +156,7 @@ export class TokenTransfer {

@ApiProperty()
@IsNotEmpty()
operator: string;
signer: string;

@ApiProperty()
@IsNotEmpty()
Expand Down Expand Up @@ -185,7 +185,7 @@ class tokenEventBase {
data?: string;

@ApiProperty()
operator?: string;
signer?: string;

@ApiProperty()
rawOutput?: any;
Expand Down
20 changes: 10 additions & 10 deletions src/tokens/tokens.service.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ describe('TokensService', () => {
const request: TokenPool = {
type: TokenType.FUNGIBLE,
requestId: REQUEST,
operator: IDENTITY,
signer: IDENTITY,
data: `{"tx":${TX}}`,
config: { address: CONTRACT_ADDRESS },
name: NAME,
Expand All @@ -166,7 +166,7 @@ describe('TokensService', () => {
const request: TokenPool = {
type: TokenType.NONFUNGIBLE,
requestId: REQUEST,
operator: IDENTITY,
signer: IDENTITY,
data: `{"tx":${TX}}`,
config: { address: CONTRACT_ADDRESS },
name: NAME,
Expand Down Expand Up @@ -283,7 +283,7 @@ describe('TokensService', () => {
it('should mint ERC20 token with correct abi and inputs', async () => {
const request: TokenMint = {
amount: '20',
operator: IDENTITY,
signer: IDENTITY,
poolId: ERC20_POOL_ID,
to: '0x123',
};
Expand Down Expand Up @@ -314,7 +314,7 @@ describe('TokensService', () => {
const request: TokenMint = {
amount: '2',
tokenIndex: '721',
operator: IDENTITY,
signer: IDENTITY,
poolId: ERC721_POOL_ID,
to: '0x123',
};
Expand All @@ -326,7 +326,7 @@ describe('TokensService', () => {
it('should mint ERC721 token with correct abi and inputs', async () => {
const request: TokenMint = {
tokenIndex: '721',
operator: IDENTITY,
signer: IDENTITY,
poolId: ERC721_POOL_ID,
to: '0x123',
};
Expand Down Expand Up @@ -358,7 +358,7 @@ describe('TokensService', () => {
it('should transfer ERC20 token with correct abi and inputs', async () => {
const request: TokenTransfer = {
amount: '20',
operator: IDENTITY,
signer: IDENTITY,
poolId: ERC20_POOL_ID,
from: IDENTITY,
to: '0x123',
Expand Down Expand Up @@ -391,7 +391,7 @@ describe('TokensService', () => {
it('should transfer ERC721 token with correct abi and inputs', async () => {
const request: TokenTransfer = {
tokenIndex: '721',
operator: IDENTITY,
signer: IDENTITY,
poolId: ERC721_POOL_ID,
from: IDENTITY,
to: '0x123',
Expand Down Expand Up @@ -424,7 +424,7 @@ describe('TokensService', () => {
it('should burn ERC20 token with correct abi and inputs', async () => {
const request: TokenBurn = {
amount: '20',
operator: IDENTITY,
signer: IDENTITY,
poolId: ERC20_POOL_ID,
from: IDENTITY,
};
Expand Down Expand Up @@ -454,7 +454,7 @@ describe('TokensService', () => {
it('should burn ERC721 token with correct abi and inputs', async () => {
const request: TokenBurn = {
tokenIndex: '721',
operator: IDENTITY,
signer: IDENTITY,
poolId: ERC721_POOL_ID,
from: IDENTITY,
};
Expand Down Expand Up @@ -484,7 +484,7 @@ describe('TokensService', () => {
});
});

describe('getters for balance/receipt/operator', () => {
describe('getter for receipt', () => {
it('should get receipt of id successfully', async () => {
const response: EventStreamReply = {
headers: {
Expand Down
22 changes: 11 additions & 11 deletions src/tokens/tokens.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -159,14 +159,14 @@ export class TokensService {
return;
}

private postOptions(operator: string, requestId?: string) {
private postOptions(signer: string, requestId?: string) {
const from = `${this.shortPrefix}-from`;
const sync = `${this.shortPrefix}-sync`;
const id = `${this.shortPrefix}-id`;

const requestOptions: AxiosRequestConfig = {
params: {
[from]: operator,
[from]: signer,
[sync]: 'false',
[id]: requestId,
},
Expand Down Expand Up @@ -244,7 +244,7 @@ export class TokensService {
headers: {
type: sendTransactionHeader,
},
from: dto.operator,
from: dto.signer,
to: validPoolId.address,
method: methodAbi,
params: [
Expand All @@ -253,7 +253,7 @@ export class TokensService {
encodeHex(dto.data ?? ''),
],
} as EthConnectMsgRequest,
this.postOptions(dto.operator, dto.requestId),
this.postOptions(dto.signer, dto.requestId),
),
);

Expand All @@ -270,7 +270,7 @@ export class TokensService {
headers: {
type: sendTransactionHeader,
},
from: dto.operator,
from: dto.signer,
to: validPoolId.address,
method: methodAbi,
params: [
Expand All @@ -280,7 +280,7 @@ export class TokensService {
encodeHex(dto.data ?? ''),
],
} as EthConnectMsgRequest,
this.postOptions(dto.operator, dto.requestId),
this.postOptions(dto.signer, dto.requestId),
),
);
return { id: response.data.id };
Expand All @@ -296,7 +296,7 @@ export class TokensService {
headers: {
type: sendTransactionHeader,
},
from: dto.operator,
from: dto.signer,
to: validPoolId.address,
method: methodAbi,
params: [
Expand All @@ -305,7 +305,7 @@ export class TokensService {
encodeHex(dto.data ?? ''),
],
} as EthConnectMsgRequest,
this.postOptions(dto.operator, dto.requestId),
this.postOptions(dto.signer, dto.requestId),
),
);
return { id: response.data.id };
Expand Down Expand Up @@ -345,7 +345,7 @@ class TokenListener implements EventListener {

private async getTokenUri(
tokenIdx: string,
operator: string,
signer: string,
contractAddress: string,
): Promise<string> {
const methodABI = standardAbiMap.ERC721WithData.find(method => method.name === 'tokenURI');
Expand All @@ -355,7 +355,7 @@ class TokenListener implements EventListener {
headers: {
type: 'Query',
},
from: operator,
from: signer,
to: contractAddress,
method: methodABI,
params: [tokenIdx],
Expand Down Expand Up @@ -404,7 +404,7 @@ class TokenListener implements EventListener {
type: poolType,
poolId: unpackedSub.poolId,
amount: poolType === TokenType.FUNGIBLE ? data.value : '1',
operator: event.inputSigner,
signer: event.inputSigner,
data: decodedData,
timestamp: event.timestamp,
rawOutput: data,
Expand Down
20 changes: 10 additions & 10 deletions test/erc20.e2e-spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ describe('AppController - ERC20/ERC721 (e2e)', () => {
const request = {
type: TokenType.FUNGIBLE,
requestId: REQUEST,
operator: IDENTITY,
signer: IDENTITY,
data: `{"tx":${TX}}`,
config: { address: CONTRACT_ADDRESS },
name: NAME,
Expand All @@ -162,7 +162,7 @@ describe('AppController - ERC20/ERC721 (e2e)', () => {
const request: TokenPool = {
type: TokenType.FUNGIBLE,
requestId: REQUEST,
operator: IDENTITY,
signer: IDENTITY,
data: `{"tx":${TX}}`,
config: { address: CONTRACT_ADDRESS },
name: NAME,
Expand All @@ -187,7 +187,7 @@ describe('AppController - ERC20/ERC721 (e2e)', () => {
const request: TokenPool = {
type: TokenType.NONFUNGIBLE,
requestId: REQUEST,
operator: IDENTITY,
signer: IDENTITY,
data: `{"tx":${TX}}`,
config: { address: CONTRACT_ADDRESS },
name: NAME,
Expand All @@ -212,7 +212,7 @@ describe('AppController - ERC20/ERC721 (e2e)', () => {
const request: TokenPool = {
type: 'funkible' as TokenType,
requestId: REQUEST,
operator: IDENTITY,
signer: IDENTITY,
data: `{"tx":${TX}}`,
config: { address: CONTRACT_ADDRESS },
name: NAME,
Expand All @@ -232,7 +232,7 @@ describe('AppController - ERC20/ERC721 (e2e)', () => {
it('Mint ERC20 token', async () => {
const request: TokenMint = {
amount: '20',
operator: IDENTITY,
signer: IDENTITY,
poolId: ERC20_POOL_ID,
to: '0x123',
};
Expand Down Expand Up @@ -263,7 +263,7 @@ describe('AppController - ERC20/ERC721 (e2e)', () => {
it('Mint ERC721 token', async () => {
const request: TokenMint = {
tokenIndex: '721',
operator: IDENTITY,
signer: IDENTITY,
poolId: ERC721_POOL_ID,
to: '0x123',
};
Expand Down Expand Up @@ -294,7 +294,7 @@ describe('AppController - ERC20/ERC721 (e2e)', () => {
it('Transfer ERC20 token', async () => {
const request: TokenTransfer = {
amount: '20',
operator: IDENTITY,
signer: IDENTITY,
poolId: ERC20_POOL_ID,
to: '0x123',
from: IDENTITY,
Expand Down Expand Up @@ -328,7 +328,7 @@ describe('AppController - ERC20/ERC721 (e2e)', () => {
it('Transfer ERC721 token', async () => {
const request: TokenTransfer = {
tokenIndex: '721',
operator: IDENTITY,
signer: IDENTITY,
poolId: ERC721_POOL_ID,
to: '0x123',
from: IDENTITY,
Expand Down Expand Up @@ -362,7 +362,7 @@ describe('AppController - ERC20/ERC721 (e2e)', () => {
it('Burn ERC20 token', async () => {
const request: TokenBurn = {
amount: '20',
operator: IDENTITY,
signer: IDENTITY,
poolId: ERC20_POOL_ID,
from: IDENTITY,
};
Expand Down Expand Up @@ -393,7 +393,7 @@ describe('AppController - ERC20/ERC721 (e2e)', () => {
it('Burn ERC721 token', async () => {
const request: TokenBurn = {
tokenIndex: '721',
operator: IDENTITY,
signer: IDENTITY,
poolId: ERC721_POOL_ID,
from: IDENTITY,
};
Expand Down
12 changes: 6 additions & 6 deletions test/ws.e2e-spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ describe('WebSocket AppController (e2e)', () => {
poolId: ERC20_POOL_ID,
to: 'A',
amount: '5',
operator: IDENTITY,
signer: IDENTITY,
data: 'test',
timestamp: '2020-01-01 00:00:00Z',
rawOutput: {
Expand Down Expand Up @@ -288,7 +288,7 @@ describe('WebSocket AppController (e2e)', () => {
poolId: ERC721_POOL_ID,
to: 'A',
amount: '1',
operator: IDENTITY,
signer: IDENTITY,
data: 'test',
timestamp: '2020-01-01 00:00:00Z',
rawOutput: {
Expand Down Expand Up @@ -336,7 +336,7 @@ describe('WebSocket AppController (e2e)', () => {
from: 'A',
to: 'B',
amount: '5',
operator: IDENTITY,
signer: IDENTITY,
data: 'test',
timestamp: '2020-01-01 00:00:00Z',
rawOutput: {
Expand Down Expand Up @@ -413,7 +413,7 @@ describe('WebSocket AppController (e2e)', () => {
from: 'A',
to: 'B',
amount: '1',
operator: IDENTITY,
signer: IDENTITY,
data: 'test',
timestamp: '2020-01-01 00:00:00Z',
rawOutput: {
Expand Down Expand Up @@ -460,7 +460,7 @@ describe('WebSocket AppController (e2e)', () => {
poolId: ERC20_POOL_ID,
from: 'B',
amount: '5',
operator: IDENTITY,
signer: IDENTITY,
data: 'test',
timestamp: '2020-01-01 00:00:00Z',
rawOutput: {
Expand Down Expand Up @@ -535,7 +535,7 @@ describe('WebSocket AppController (e2e)', () => {
poolId: ERC721_POOL_ID,
from: 'B',
amount: '1',
operator: IDENTITY,
signer: IDENTITY,
data: 'test',
timestamp: '2020-01-01 00:00:00Z',
rawOutput: {
Expand Down

0 comments on commit b5677c0

Please sign in to comment.