Move .isEmpty to $isEmpty (#5424)

* Move .isEmpty to $isEmpty

* Adjust usages
This commit is contained in:
Jaco
2023-01-19 11:07:29 +02:00
committed by GitHub
parent 4688291ecf
commit 6f19084a4d
66 changed files with 249 additions and 146 deletions
+1 -1
View File
@@ -98,4 +98,4 @@ const tt9 = registry.createType('(u32, (u32, u64), Vec<u8>, Vec<(u32, u64)>, [u8
// tuple with nested fixed
const tta = registry.createType('([u8;32], [u16;5])');
assert(tt1[2].bitLength() && tt2.bitLength() && tt4[3].bitLength() && tt5.isEmpty && tt6[1].toHuman() && tt7.toHuman() && tt8.toHuman() && tt9.toHuman() && tta[1][1].bitLength(), 'All ok');
assert(tt1[2].bitLength() && tt2.bitLength() && tt4[3].bitLength() && tt5.$isEmpty && tt6[1].toHuman() && tt7.toHuman() && tt8.toHuman() && tt9.toHuman() && tta[1][1].bitLength(), 'All ok');
+1 -1
View File
@@ -22,7 +22,7 @@ describe('createType', (): void => {
expect(f64.toRawType()).toEqual('Fixed64');
expect(f64.bitLength()).toEqual(64);
expect(f64.isUnsigned).toBe(false);
expect(f64.$isUnsigned).toBe(false);
expect(f64 instanceof Int).toBe(true);
});
@@ -19,7 +19,7 @@ describe('EthereumAccountId', (): void => {
});
it('is empty by default', (): void => {
expect(id.isEmpty).toBe(true);
expect(id.$isEmpty).toBe(true);
});
it('equals the empty address', (): void => {
@@ -77,7 +77,7 @@ describe('EthereumAccountId', (): void => {
]));
it('decodes to a non-empty value', (): void => {
expect(registry.createType('EthereumAccountId', '0x4119b2e6c3Cb618F4f0B93ac77f9BeeC7FF02887').isEmpty).toBe(false);
expect(registry.createType('EthereumAccountId', '0x4119b2e6c3Cb618F4f0B93ac77f9BeeC7FF02887').$isEmpty).toBe(false);
});
});
});
@@ -72,7 +72,7 @@ export class GenericExtrinsicSignatureV4 extends Struct implements IExtrinsicSig
* @description `true` if the signature is valid
*/
public get isSigned (): boolean {
return !this.signature.isEmpty;
return !this.signature.$isEmpty;
}
/**
+2 -2
View File
@@ -19,7 +19,7 @@ describe('AccountId', (): void => {
});
it('is empty by default', (): void => {
expect(id.isEmpty).toBe(true);
expect(id.$isEmpty).toBe(true);
});
it('equals the empty address', (): void => {
@@ -125,7 +125,7 @@ describe('AccountId', (): void => {
expect(
registry
.createType('AccountId', 'FVU8T5yaAssHAUwo3PnKso7fqNthEqJZGCZgJZSR9cKjWAf')
.isEmpty
.$isEmpty
).toBe(false);
});
+1 -1
View File
@@ -11,7 +11,7 @@ export class MagicNumber extends U32 {
constructor (registry: Registry, value?: AnyNumber) {
super(registry, value);
if (!this.isEmpty && !this.eq(MAGIC_NUMBER)) {
if (!this.$isEmpty && !this.eq(MAGIC_NUMBER)) {
throw new Error(`MagicNumber mismatch: expected ${registry.createTypeUnsafe('u32', [MAGIC_NUMBER]).toHex()}, found ${this.toHex()}`);
}
}
@@ -17,7 +17,7 @@ export function decorateConstants (registry: Registry, { pallets }: MetadataLate
for (let i = 0; i < pallets.length; i++) {
const { constants, name } = pallets[i];
if (!constants.isEmpty) {
if (!constants.$isEmpty) {
lazyMethod(result, stringCamelCase(name), () =>
lazyMethods(
{},