Rename Struct.get to .getAtIndex (#310)
* Rename to getAtIndex * Fix lint
This commit is contained in:
@@ -94,11 +94,11 @@ export class OuterEventMetadataEvent extends Tuple {
|
||||
}
|
||||
|
||||
get events (): Vector<EventMetadata> {
|
||||
return this.get(1) as Vector<EventMetadata>;
|
||||
return this.getAtIndex(1) as Vector<EventMetadata>;
|
||||
}
|
||||
|
||||
get name (): Text {
|
||||
return this.get(0) as Text;
|
||||
return this.getAtIndex(0) as Text;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -125,15 +125,15 @@ export default class Method extends Struct {
|
||||
}
|
||||
|
||||
get args (): Array<Base> {
|
||||
return (this.get(1) as Struct<Base>).values();
|
||||
return (this.getAtIndex(1) as Struct<Base>).values();
|
||||
}
|
||||
|
||||
get callIndex (): Uint8Array {
|
||||
return (this.get(0) as MethodIndex).callIndex;
|
||||
return (this.getAtIndex(0) as MethodIndex).callIndex;
|
||||
}
|
||||
|
||||
get data (): Uint8Array {
|
||||
return (this.get(1) as Struct<Base>).toU8a();
|
||||
return (this.getAtIndex(1) as Struct<Base>).toU8a();
|
||||
}
|
||||
|
||||
get meta (): FunctionMetadata {
|
||||
|
||||
@@ -124,7 +124,7 @@ export default class Struct<
|
||||
}, 0);
|
||||
}
|
||||
|
||||
get (index: number): Base {
|
||||
getAtIndex (index: number): Base {
|
||||
return this.values()[index];
|
||||
}
|
||||
|
||||
|
||||
@@ -58,8 +58,8 @@ describe('Tuple', () => {
|
||||
threshold: VoteThreshold
|
||||
}))('0x62190000000000000003507b0a092230783432223a202230783433220a7d0a01');
|
||||
|
||||
expect(test.get(0).toNumber()).toEqual(6498);
|
||||
expect(test.get(1).callIndex).toEqual(new Uint8Array([0, 3]));
|
||||
expect(test.get(2).toNumber()).toEqual(1);
|
||||
expect(test.getAtIndex(0).toNumber()).toEqual(6498);
|
||||
expect(test.getAtIndex(1).callIndex).toEqual(new Uint8Array([0, 3]));
|
||||
expect(test.getAtIndex(2).toNumber()).toEqual(1);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -53,9 +53,9 @@ describe('Vector', () => {
|
||||
]));
|
||||
const first = test.get(0);
|
||||
|
||||
expect(first.get(0).toNumber()).toEqual(10);
|
||||
expect(first.get(1).callIndex).toEqual(new Uint8Array([0, 3]));
|
||||
expect(first.get(2).toString()).toEqual('5GoKvZWG5ZPYL1WUovuHW3zJBWBP5eT8CbqjdRY4Q6iMaDtZ');
|
||||
expect(first.getAtIndex(0).toNumber()).toEqual(10);
|
||||
expect(first.getAtIndex(1).callIndex).toEqual(new Uint8Array([0, 3]));
|
||||
expect(first.getAtIndex(2).toString()).toEqual('5GoKvZWG5ZPYL1WUovuHW3zJBWBP5eT8CbqjdRY4Q6iMaDtZ');
|
||||
});
|
||||
|
||||
describe('array-like functions', () => {
|
||||
|
||||
Reference in New Issue
Block a user