refactor: change structure of code
This commit is contained in:
parent
d2bbf76d90
commit
3ec30e911d
@ -13,7 +13,7 @@ function hashCode(str: string): string {
|
||||
// eslint-disable-next-line no-bitwise
|
||||
hash |= 0;
|
||||
}
|
||||
return `${hash.toString(16)}`;
|
||||
return `${(hash < 0 ? hash * -1 : hash).toString(16)}`;
|
||||
}
|
||||
|
||||
export const addWord = async (...[word]: AddWordArgs) => {
|
||||
|
||||
@ -10,8 +10,8 @@ import {
|
||||
import { getCallParameters, queue } from 'lib/onchain';
|
||||
|
||||
import { context, getRawContext, setRawContext } from './context';
|
||||
import { getAwaitedOps } from './ops/awaited';
|
||||
import { pushResolvedOp } from './ops/resolved';
|
||||
import { getAwaitedOps } from './promisifedOps/awaited';
|
||||
import { pushResolvedOp } from './promisifedOps/resolved';
|
||||
|
||||
let abortExecution: (() => void) | null = null;
|
||||
|
||||
|
||||
@ -1,3 +1,3 @@
|
||||
export * from './context';
|
||||
export * from './executor';
|
||||
export * from './ops';
|
||||
export * from './promisifedOps';
|
||||
|
||||
3
packages/cwait/src/onchain/promisifedOps/index.ts
Normal file
3
packages/cwait/src/onchain/promisifedOps/index.ts
Normal file
@ -0,0 +1,3 @@
|
||||
export * from './awaited';
|
||||
export * from './resolved';
|
||||
export * from './ops';
|
||||
@ -1,7 +1,7 @@
|
||||
import { BlockFilter, constructBlock, extractBlock, isResolvedBlock } from '@coinweb/contract-kit';
|
||||
|
||||
import { pushAwaitedOp } from './awaited';
|
||||
import { shiftResolvedOp } from './resolved';
|
||||
import { pushAwaitedOp } from '../awaited';
|
||||
import { shiftResolvedOp } from '../resolved';
|
||||
|
||||
export const blockOp = (filters: BlockFilter[]) =>
|
||||
new Promise<[BlockFilter, boolean][] | null>((resolve, reject) => {
|
||||
@ -1,6 +1,5 @@
|
||||
export * from './awaited';
|
||||
export * from './block';
|
||||
export * from './rangeRead';
|
||||
export * from './read';
|
||||
export * from './resolved';
|
||||
export * from './store';
|
||||
export * from './take';
|
||||
@ -1,11 +1,10 @@
|
||||
import { Claim, ClaimKey, constructRangeRead, extractRead, isResolvedRead } from '@coinweb/contract-kit';
|
||||
import { ClaimRange } from '@coinweb/contract-kit/dist/types/operations/read';
|
||||
|
||||
import { TypedClaim } from '../../types';
|
||||
import { context } from '../context';
|
||||
|
||||
import { pushAwaitedOp } from './awaited';
|
||||
import { shiftResolvedOp } from './resolved';
|
||||
import { TypedClaim } from '../../../types';
|
||||
import { context } from '../../context';
|
||||
import { pushAwaitedOp } from '../awaited';
|
||||
import { shiftResolvedOp } from '../resolved';
|
||||
|
||||
export const rangeReadOp = <TClaims extends Claim[] = TypedClaim[]>(
|
||||
firstPart: ClaimKey['first_part'],
|
||||
@ -1,10 +1,9 @@
|
||||
import { Claim, ClaimKey, constructRead, extractRead, isResolvedRead } from '@coinweb/contract-kit';
|
||||
|
||||
import { TypedClaim } from '../../types';
|
||||
import { context } from '../context';
|
||||
|
||||
import { pushAwaitedOp } from './awaited';
|
||||
import { shiftResolvedOp } from './resolved';
|
||||
import { TypedClaim } from '../../../types';
|
||||
import { context } from '../../context';
|
||||
import { pushAwaitedOp } from '../awaited';
|
||||
import { shiftResolvedOp } from '../resolved';
|
||||
|
||||
export const readOp = <TClaim extends Claim = TypedClaim>(key: ClaimKey) => {
|
||||
return new Promise<TClaim | null>((resolve, reject) => {
|
||||
@ -1,8 +1,8 @@
|
||||
import { Claim, constructStore, isResolvedStore } from '@coinweb/contract-kit';
|
||||
import { extractStore } from '@coinweb/contract-kit/dist/esm/operations/store';
|
||||
|
||||
import { pushAwaitedOp } from './awaited';
|
||||
import { shiftResolvedOp } from './resolved';
|
||||
import { pushAwaitedOp } from '../awaited';
|
||||
import { shiftResolvedOp } from '../resolved';
|
||||
|
||||
export const storeOp = (claim: Claim) =>
|
||||
new Promise<Claim | null>((resolve, reject) => {
|
||||
@ -1,9 +1,8 @@
|
||||
import { constructTake, extractTake, isResolvedTake, Claim, ClaimKey } from '@coinweb/contract-kit';
|
||||
|
||||
import { TypedClaim } from '../../types';
|
||||
|
||||
import { pushAwaitedOp } from './awaited';
|
||||
import { shiftResolvedOp } from './resolved';
|
||||
import { TypedClaim } from '../../../types';
|
||||
import { pushAwaitedOp } from '../awaited';
|
||||
import { shiftResolvedOp } from '../resolved';
|
||||
|
||||
export const takeOp = <TClaim extends Claim = TypedClaim>(key: ClaimKey) =>
|
||||
new Promise<TClaim | null>((resolve, reject) => {
|
||||
Loading…
x
Reference in New Issue
Block a user