Bump dev (#1344)
This commit is contained in:
@@ -26,6 +26,6 @@ export default abstract class RxBase implements ContractBase<'rxjs'> {
|
||||
// cater for substrate 2.x & 1.x (in order)
|
||||
this.apiContracts = api.tx.contracts || api.tx.contract;
|
||||
|
||||
assert(this.apiContracts && this.apiContracts.putCode, `You need to connect to a node with the contracts module, the metadata does not enable api.tx.contracts on this instance`);
|
||||
assert(this.apiContracts && this.apiContracts.putCode, 'You need to connect to a node with the contracts module, the metadata does not enable api.tx.contracts on this instance');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,7 +16,7 @@ export function typeToString (type: ContractABITypes): string {
|
||||
} else if (type['Option<T>']) {
|
||||
return `Option<${typeToString(type['Option<T>'].T)}>`;
|
||||
} else if (type['Result<T,E>']) {
|
||||
return `()`; // Result is not supported, but only applicable for returns
|
||||
return '()'; // Result is not supported, but only applicable for returns
|
||||
} else if (type['Vec<T>']) {
|
||||
return `Vec<${typeToString(type['Vec<T>'].T)}>`;
|
||||
} else if (type['[T;n]']) {
|
||||
|
||||
@@ -28,7 +28,7 @@ try {
|
||||
}
|
||||
|
||||
function assertResult <T> (value: T | undefined): T {
|
||||
assert(!isUndefined(value), `Api needs to be initialised before using, listen on 'ready'`);
|
||||
assert(!isUndefined(value), 'Api needs to be initialised before using, listen on \'ready\'');
|
||||
|
||||
return value as T;
|
||||
}
|
||||
|
||||
@@ -84,7 +84,7 @@ describe('Combinator', (): void => {
|
||||
const mocker = async (): Promise<any> => done;
|
||||
const combinator = new Combinator([
|
||||
mocker,
|
||||
async (): UnsubscribePromise => (): void => void 0
|
||||
async (): UnsubscribePromise => (): void => {}
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
], (value: any[]): void => {
|
||||
// ignore
|
||||
|
||||
@@ -50,7 +50,7 @@ export function describeE2E (options?: Options): (message: string, inner: (wsUrl
|
||||
return function (message: string, inner: (wsUrl: string) => void): void {
|
||||
const wsEndpoints = getWsEndpoints(options);
|
||||
if (!wsEndpoints.length) {
|
||||
describe(`Empty test Suite:`, (): void => {
|
||||
describe('Empty test Suite', (): void => {
|
||||
it('No tests found for passed endpoints', (): void => {});
|
||||
});
|
||||
} else {
|
||||
|
||||
@@ -85,7 +85,7 @@ export default class HttpProvider implements ProviderInterface {
|
||||
*/
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
public on (type: ProviderInterfaceEmitted, sub: ProviderInterfaceEmitCb): void {
|
||||
l.error(`HTTP Provider does not have 'on' emitters, use WebSockets instead`);
|
||||
l.error('HTTP Provider does not have \'on\' emitters, use WebSockets instead');
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -31,7 +31,7 @@ describe('send', (): void => {
|
||||
return http
|
||||
.send('test_body', ['param'])
|
||||
.then((): void => {
|
||||
expect((mock.body as any)['test_body']).toEqual({
|
||||
expect((mock.body as any).test_body).toEqual({
|
||||
id: 1,
|
||||
jsonrpc: '2.0',
|
||||
method: 'test_body',
|
||||
|
||||
@@ -21,7 +21,7 @@ describe('subscribe', (): void => {
|
||||
|
||||
it('returns a subscription id', (): Promise<void> => {
|
||||
return mock
|
||||
.subscribe('chain_newHead', 'chain_subscribeNewHead', (): void => void 0)
|
||||
.subscribe('chain_newHead', 'chain_subscribeNewHead', (): void => {})
|
||||
.then((id): void => {
|
||||
expect(id).toEqual(1);
|
||||
});
|
||||
@@ -29,7 +29,7 @@ describe('subscribe', (): void => {
|
||||
|
||||
it('calls back with the last known value', (done): Promise<number> => {
|
||||
mock.isUpdating = false;
|
||||
mock.subscriptions['chain_subscribeNewHead'].lastValue = 'testValue';
|
||||
mock.subscriptions.chain_subscribeNewHead.lastValue = 'testValue';
|
||||
|
||||
return mock.subscribe('chain_newHead', 'chain_subscribeNewHead', (_: any, value: string): void => {
|
||||
expect(value).toEqual('testValue');
|
||||
|
||||
@@ -12,7 +12,7 @@ describe('unsubscribe', (): void => {
|
||||
mock = new Mock();
|
||||
|
||||
return mock
|
||||
.subscribe('chain_newHead', 'chain_subscribeNewHead', (): void => void 0)
|
||||
.subscribe('chain_newHead', 'chain_subscribeNewHead', (): void => {})
|
||||
.then((_id): void => {
|
||||
id = _id;
|
||||
});
|
||||
|
||||
@@ -70,7 +70,7 @@ describe('send', (): void => {
|
||||
.send('test_body', ['param'])
|
||||
.then((): void => {
|
||||
expect(
|
||||
(mock.body as any)['test_body']
|
||||
(mock.body as any).test_body
|
||||
).toEqual('{"id":1,"jsonrpc":"2.0","method":"test_body","params":["param"]}');
|
||||
});
|
||||
});
|
||||
|
||||
@@ -34,7 +34,7 @@ describe('Date', (): void => {
|
||||
testEncode('toNumber', 421);
|
||||
testEncode('toU8a', Uint8Array.from([165, 1, 0, 0, 0, 0, 0, 0]));
|
||||
|
||||
it(`can encode toString`, (): void => {
|
||||
it('can encode toString', (): void => {
|
||||
expect(
|
||||
new CodecDate(421)
|
||||
.toString()
|
||||
|
||||
@@ -107,7 +107,7 @@ export default class U8a extends Uint8Array implements Codec {
|
||||
* @description Returns the base runtime type name for this instance
|
||||
*/
|
||||
public toRawType (): string {
|
||||
return `&[u8]`;
|
||||
return '&[u8]';
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -17,7 +17,7 @@ describe('StorageKey', (): void => {
|
||||
describe('with MetadataV3 (uses xxHash by default)', (): void => {
|
||||
const storage = fromMetadata(new Metadata(rpcDataV3));
|
||||
|
||||
it(`should correctly get Alice's freeBalance storage key (hex)`, (): void => {
|
||||
it('should correctly get Alice\'s freeBalance storage key (hex)', (): void => {
|
||||
expect(
|
||||
new StorageKey(
|
||||
storage
|
||||
@@ -28,7 +28,7 @@ describe('StorageKey', (): void => {
|
||||
).toBe('0xc99f5446efa57788f39ab529311f4550'); // FIXME OK this should be length-prefixed in reality
|
||||
});
|
||||
|
||||
it(`should correctly get Alice's freeBalance storage key (u8a)`, (): void => {
|
||||
it('should correctly get Alice\'s freeBalance storage key (u8a)', (): void => {
|
||||
expect(
|
||||
new StorageKey(
|
||||
storage
|
||||
@@ -46,7 +46,7 @@ describe('StorageKey', (): void => {
|
||||
describe('with MetadataV4 (uses xxHash by default)', (): void => {
|
||||
const storage = fromMetadata(new Metadata(rpcDataV4));
|
||||
|
||||
it(`should correctly get Alice's freeBalance storage key (hex)`, (): void => {
|
||||
it('should correctly get Alice\'s freeBalance storage key (hex)', (): void => {
|
||||
expect(
|
||||
new StorageKey(
|
||||
storage
|
||||
@@ -57,7 +57,7 @@ describe('StorageKey', (): void => {
|
||||
).toBe('0x7f864e18e3dd8b58386310d2fe0919eef27c6e558564b7f67f22d99d20f587bb');
|
||||
});
|
||||
|
||||
it(`should correctly get Alice's freeBalance storage key (u8a)`, (): void => {
|
||||
it('should correctly get Alice\'s freeBalance storage key (u8a)', (): void => {
|
||||
expect(
|
||||
new StorageKey(
|
||||
storage
|
||||
@@ -73,7 +73,7 @@ describe('StorageKey', (): void => {
|
||||
);
|
||||
});
|
||||
|
||||
it(`should correctly get the EventTopics double map storage key (hex)`, (): void => {
|
||||
it('should correctly get the EventTopics double map storage key (hex)', (): void => {
|
||||
expect(
|
||||
new StorageKey([
|
||||
storage
|
||||
@@ -85,7 +85,7 @@ describe('StorageKey', (): void => {
|
||||
).toBe('0x3007c9ff7027f65900abcdfca4fdb107ead47e2a9e3558e01b691b0f4a5f8518d487326614f066416308bf6aa4e5041d1949928e4b26ede98e3cebb36a3b1726');
|
||||
});
|
||||
|
||||
it(`should correctly get the EventTopics double map storage key (u8a)`, (): void => {
|
||||
it('should correctly get the EventTopics double map storage key (u8a)', (): void => {
|
||||
expect(
|
||||
new StorageKey([
|
||||
storage
|
||||
@@ -101,7 +101,7 @@ describe('StorageKey', (): void => {
|
||||
describe('with MetadataV5', (): void => {
|
||||
const storage = fromMetadata(new Metadata(rpcDataV5));
|
||||
|
||||
it(`should correctly get the EventTopics double map storage key (hex)`, (): void => {
|
||||
it('should correctly get the EventTopics double map storage key (hex)', (): void => {
|
||||
expect(
|
||||
new StorageKey([
|
||||
storage
|
||||
@@ -113,7 +113,7 @@ describe('StorageKey', (): void => {
|
||||
).toBe('0x3007c9ff7027f65900abcdfca4fdb107ead47e2a9e3558e01b691b0f4a5f8518d487326614f066416308bf6aa4e5041d1949928e4b26ede98e3cebb36a3b1726');
|
||||
});
|
||||
|
||||
it(`should correctly get the EventTopics double map storage key (u8a)`, (): void => {
|
||||
it('should correctly get the EventTopics double map storage key (u8a)', (): void => {
|
||||
expect(
|
||||
new StorageKey([
|
||||
storage
|
||||
@@ -129,7 +129,7 @@ describe('StorageKey', (): void => {
|
||||
describe('with MetadataV6', (): void => {
|
||||
const storage = fromMetadata(new Metadata(rpcDataV6));
|
||||
|
||||
it(`should correctly get the EventTopics double map storage key (hex)`, (): void => {
|
||||
it('should correctly get the EventTopics double map storage key (hex)', (): void => {
|
||||
expect(
|
||||
new StorageKey([
|
||||
storage
|
||||
@@ -141,7 +141,7 @@ describe('StorageKey', (): void => {
|
||||
).toBe('0x3007c9ff7027f65900abcdfca4fdb107ead47e2a9e3558e01b691b0f4a5f8518d487326614f066416308bf6aa4e5041d1949928e4b26ede98e3cebb36a3b1726');
|
||||
});
|
||||
|
||||
it(`should correctly get the EventTopics double map storage key (u8a)`, (): void => {
|
||||
it('should correctly get the EventTopics double map storage key (u8a)', (): void => {
|
||||
expect(
|
||||
new StorageKey([
|
||||
storage
|
||||
@@ -157,7 +157,7 @@ describe('StorageKey', (): void => {
|
||||
describe('with MetadataV7', (): void => {
|
||||
const storage = fromMetadata(new Metadata(rpcDataV7));
|
||||
|
||||
it(`should correctly get the EventTopics double map storage key (hex)`, (): void => {
|
||||
it('should correctly get the EventTopics double map storage key (hex)', (): void => {
|
||||
expect(
|
||||
new StorageKey([
|
||||
storage
|
||||
@@ -169,7 +169,7 @@ describe('StorageKey', (): void => {
|
||||
).toBe('0x3007c9ff7027f65900abcdfca4fdb107ead47e2a9e3558e01b691b0f4a5f8518d487326614f066416308bf6aa4e5041d1949928e4b26ede98e3cebb36a3b1726');
|
||||
});
|
||||
|
||||
it(`should correctly get the EventTopics double map storage key (u8a)`, (): void => {
|
||||
it('should correctly get the EventTopics double map storage key (u8a)', (): void => {
|
||||
expect(
|
||||
new StorageKey([
|
||||
storage
|
||||
|
||||
@@ -52,7 +52,7 @@ function addRpc (): string {
|
||||
const renderMethod = `${md}\n▸ **${methodName}**(${args})`;
|
||||
const renderReturnType = `: ${type}`;
|
||||
const renderSignature = `${renderMethod}${renderReturnType}`;
|
||||
const renderSummary = `${method && method.description ? `\n- **summary**: ${method.description}\n` : `\n\n`}`;
|
||||
const renderSummary = `${method && method.description ? `\n- **summary**: ${method.description}\n` : '\n\n'}`;
|
||||
|
||||
return `${renderSignature}${renderSummary}`;
|
||||
}, renderSection);
|
||||
|
||||
@@ -361,7 +361,7 @@ function generateTsDef (defName: string, { types }: { types: Record<string, any>
|
||||
});
|
||||
|
||||
fs.writeFileSync(`packages/types/src/interfaces/${defName}/types.ts`, header.concat(sortedDefs).concat(FOOTER), { flag: 'w' });
|
||||
fs.writeFileSync(`packages/types/src/interfaces/${defName}/index.ts`, HEADER.concat(`export * from './types';`).concat(FOOTER), { flag: 'w' });
|
||||
fs.writeFileSync(`packages/types/src/interfaces/${defName}/index.ts`, HEADER.concat('export * from \'./types\';').concat(FOOTER), { flag: 'w' });
|
||||
}
|
||||
|
||||
// Generate `packages/types/src/interfaceRegistry.ts`, the registry of all interfaces
|
||||
@@ -411,7 +411,7 @@ function generateInterfaceRegistry (): void {
|
||||
const interfaceEnd = '\n}';
|
||||
|
||||
fs.writeFileSync(
|
||||
`packages/types/src/interfaceRegistry.ts`,
|
||||
'packages/types/src/interfaceRegistry.ts',
|
||||
header.concat(interfaceStart).concat(primitives).concat(srml).concat(interfaceEnd).concat(FOOTER)
|
||||
, { flag: 'w' }
|
||||
);
|
||||
@@ -472,9 +472,9 @@ function generateRpcTypes (): void {
|
||||
// FIXME These 2 are too hard to type, I give up
|
||||
if (method.method === 'getStorage') {
|
||||
setImports(imports, ['Codec']);
|
||||
return ` getStorage<T = Codec>(key: any, block?: Hash | Uint8Array | string): Observable<T>;`;
|
||||
return ' getStorage<T = Codec>(key: any, block?: Hash | Uint8Array | string): Observable<T>;';
|
||||
} else if (method.method === 'subscribeStorage') {
|
||||
return ` subscribeStorage<T = Codec[]>(keys: any[]): Observable<T>;`;
|
||||
return ' subscribeStorage<T = Codec[]>(keys: any[]): Observable<T>;';
|
||||
}
|
||||
|
||||
const args = method.params.map((param): string => {
|
||||
@@ -491,7 +491,7 @@ function generateRpcTypes (): void {
|
||||
[
|
||||
` ${section}: {`,
|
||||
...allMethods,
|
||||
` };`
|
||||
' };'
|
||||
].join('\n')
|
||||
);
|
||||
}, []).join('\n');
|
||||
@@ -522,7 +522,7 @@ function generateRpcTypes (): void {
|
||||
const interfaceEnd = '\n}';
|
||||
|
||||
fs.writeFileSync(
|
||||
`packages/rpc-core/src/jsonrpc.types.ts`,
|
||||
'packages/rpc-core/src/jsonrpc.types.ts',
|
||||
header.concat(interfaceStart).concat(body).concat(interfaceEnd).concat(FOOTER)
|
||||
, { flag: 'w' }
|
||||
);
|
||||
@@ -535,16 +535,16 @@ function main (): void {
|
||||
generateTsDef(defName, obj);
|
||||
});
|
||||
|
||||
console.log(`Writing interfaces/types.ts`);
|
||||
console.log('Writing interfaces/types.ts');
|
||||
|
||||
fs.writeFileSync(`packages/types/src/interfaces/types.ts`, HEADER.concat(Object.keys(definitions).map((moduleName): string => `export * from './${moduleName}/types';`).join('\n')).concat(FOOTER), { flag: 'w' });
|
||||
fs.writeFileSync(`packages/types/src/interfaces/index.ts`, HEADER.concat(`export * from './types';`).concat(FOOTER), { flag: 'w' });
|
||||
fs.writeFileSync('packages/types/src/interfaces/types.ts', HEADER.concat(Object.keys(definitions).map((moduleName): string => `export * from './${moduleName}/types';`).join('\n')).concat(FOOTER), { flag: 'w' });
|
||||
fs.writeFileSync('packages/types/src/interfaces/index.ts', HEADER.concat('export * from \'./types\';').concat(FOOTER), { flag: 'w' });
|
||||
|
||||
console.log(`Writing interfaceRegistry.ts`);
|
||||
console.log('Writing interfaceRegistry.ts');
|
||||
|
||||
generateInterfaceRegistry();
|
||||
|
||||
console.log(`Writing packages/rpc-core/jsonrpc.types.ts`);
|
||||
console.log('Writing packages/rpc-core/jsonrpc.types.ts');
|
||||
|
||||
generateRpcTypes();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user