Skip to content

Commit

Permalink
fix types, dedupe contracts
Browse files Browse the repository at this point in the history
  • Loading branch information
lukachi committed Mar 5, 2024
1 parent 1d44965 commit f330eb4
Show file tree
Hide file tree
Showing 27 changed files with 35 additions and 3,679 deletions.
File renamed without changes.
File renamed without changes.
7 changes: 5 additions & 2 deletions packages/connector/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@
"lint:types": "tsc --noEmit --pretty",
"lint:style": "eslint --color 'src/**/*.{js,ts,tsx}'",
"lint:style:fix": "yarn run lint:style --fix",
"prepublishOnly": "yarn build"
"prepublishOnly": "yarn build",
"generate-ether-types": "typechain --target=ethers-v5 'abis/**/*.json' --out-dir src/zkp/types/contracts"
},
"dependencies": {
"@cosmjs/amino": "^0.32.2",
Expand All @@ -36,8 +37,10 @@
"long": "^5.2.3"
},
"devDependencies": {
"@typechain/ethers-v5": "11.1.1",
"cosmjs-types": "^0.9.0",
"tsc-alias": "^1.8.8"
"tsc-alias": "^1.8.8",
"typechain": "8.3.1"
},
"publishConfig": {
"access": "public"
Expand Down
8 changes: 0 additions & 8 deletions packages/connector/src/zkp/contracts/index.ts

This file was deleted.

7 changes: 3 additions & 4 deletions packages/connector/src/zkp/helpers/state-v2-helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,17 @@
import type { TransactionRequest } from '@ethersproject/providers';
import { utils } from 'ethers';

import { LightweightStateV2__factory } from '../contracts';

import { FetcherError } from '@/helpers/error-helper';
import { sleep } from '@/helpers/promise';
import { CORE_POLLING_INTERVAL } from '@/zkp';
import { CORE_POLLING_INTERVAL } from '@/zkp/consts';
import type {
RarimoChainInfo,
StateInfo,
Operation,
OperationProof,
UpdateStateDetails,
} from '@/zkp';
} from '@/zkp/types';
import { LightweightStateV2__factory } from '@/zkp/types/contracts';

export const loadDataFromRarimoCore = async <T>(
url: string,
Expand Down
11 changes: 11 additions & 0 deletions packages/connector/src/zkp/types/contracts/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
/* Autogenerated file. Do not edit manually. */
/* tslint:disable */
/* eslint-disable */
export type {
ILightweightStateV2,
LightweightStateV2,
} from './LightweightStateV2';
export type { StateV2 } from './StateV2';
export * as factories from './factories';
export { LightweightStateV2__factory } from './factories/LightweightStateV2__factory';
export { StateV2__factory } from './factories/StateV2__factory';
1 change: 1 addition & 0 deletions packages/connector/src/zkp/types/index.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
export * from './params';
export * from './zkp';
export * from './contracts';
4 changes: 0 additions & 4 deletions packages/connector/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,6 @@
"dom",
"es2017"
],
"typeRoots": [
"node_modules/@types",
"src/zkp/types"
],
"paths": {
"@/*": ["src/*"]
}
Expand Down
3 changes: 0 additions & 3 deletions packages/snap/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@
"test:snap": "node --experimental-vm-modules --trace-warnings ../../node_modules/jest/bin/jest.js --findRelatedTests src/tests/index.test.ts",
"test": "yarn test:vc && yarn test:snap",
"typia:generate": "typia generate --input src/typia-templates --output src/typia-generated --project tsconfig.json",
"generate-ether-types": "typechain --target=ethers-v5 'abis/**/*.json' --out-dir src/zkp/types/contracts",
"prepublishOnly": "yarn && yarn build",
"preversion": "yarn && yarn build && git add snap.manifest.json",
"composedb": "composedb",
Expand Down Expand Up @@ -90,7 +89,6 @@
"@lavamoat/allow-scripts": "2.0.3",
"@metamask/auto-changelog": "^3.4.4",
"@metamask/snaps-cli": "^5.0.0",
"@typechain/ethers-v5": "11.1.1",
"@types/intl": "1.2.0",
"@types/lodash": "^4.14.202",
"@types/uuid": "9.0.2",
Expand All @@ -99,7 +97,6 @@
"nodemon": "2.0.20",
"npm-commands": "^1.2.1",
"rimraf": "3.0.2",
"typechain": "8.3.1",
"typescript": "4.7.4"
},
"packageManager": "[email protected]",
Expand Down
2 changes: 1 addition & 1 deletion packages/snap/snap.manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"url": "https://github.com/rarimo/rarime.git"
},
"source": {
"shasum": "qNduoTU1RL3eeZVrQhDZbX77yb295auV4UUQ2oeZehc=",
"shasum": "3LWRoNGG0qiLPG6QV/aHUAe30bt1fI1chnxE8PRu3rI=",
"location": {
"npm": {
"filePath": "dist/bundle.js",
Expand Down
9 changes: 7 additions & 2 deletions packages/snap/src/wallet/handlers/WalletSignDirect.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import type {
SnapRequestParams,
SnapRequestsResponses,
} from '@rarimo/rarime-connector';
import type { SignDoc } from 'cosmjs-types/cosmos/tx/v1beta1/tx';
import Long from 'long';

import { getChainDetails, validateChainId } from '@/wallet/chain';
Expand All @@ -21,7 +22,11 @@ export const walletSignDirect = async ({
const params =
request.params as unknown as SnapRequestParams[RPCMethods.WalletSignDirect];

const panels = parser.parse(params.signDoc, origin, 'direct');
const panels = parser.parse(
params.signDoc as unknown as SignDoc,
origin,
'direct',
);

const confirmed = await snap.request({
method: 'snap_dialog',
Expand Down Expand Up @@ -51,6 +56,6 @@ export const walletSignDirect = async ({
bodyBytes: new Uint8Array(Object.values(signDoc.bodyBytes)),
authInfoBytes: new Uint8Array(Object.values(signDoc.authInfoBytes)),
chainId: signDoc.chainId,
accountNumber,
accountNumber: accountNumber as unknown as bigint,
});
};
7 changes: 5 additions & 2 deletions packages/snap/src/zkp/helpers/state-v2-helpers.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
/* eslint-disable camelcase */
import type { TransactionRequest } from '@ethersproject/providers';
import type { ILightweightStateV2 } from '@rarimo/rarime-connector';
import {
LightweightStateV2__factory,
StateV2__factory,
} from '@rarimo/rarime-connector';
import { providers, utils } from 'ethers';

import type { ChainInfo } from '@/types';
Expand All @@ -17,8 +22,6 @@ import type {
OperationProof,
StateProof,
} from '@/zkp/types';
import { LightweightStateV2__factory, StateV2__factory } from '@/zkp/types';
import type { ILightweightStateV2 } from '@/zkp/types/contracts/LightweightStateV2';

export const getGISTProof = async ({
rpcUrl,
Expand Down
Loading

0 comments on commit f330eb4

Please sign in to comment.