diff --git a/etc/ofac.js b/etc/ofac.js new file mode 100644 index 000000000..07865a053 --- /dev/null +++ b/etc/ofac.js @@ -0,0 +1,39 @@ +/* eslint-disable no-console */ +const { dirname } = require('node:path') +const { mkdirSync, existsSync, writeFileSync } = require('node:fs') + +const storeJsonFile = (path, data) => { + const dirPath = dirname(path) + + if (!existsSync(dirPath)) { + try { + mkdirSync(dirPath, { recursive: true }) + } catch (e) { + console.log('❌❌❌ Error creating directory', e) + } + } + + try { + writeFileSync(path, data) + } catch (e) { + console.error(`❌❌❌ Error creating JSON file: ${path}`, e) + } +} + +const fetchOfac = async () => { + const response = await fetch( + 'https://raw.githubusercontent.com/InjectiveLabs/injective-lists/master/wallets/ofac.json', + ) + const wallets = await response.text() + + try { + storeJsonFile(`src/json/ofac.ts`, `export const ofacWallets = ${wallets}`) + + console.log(`✅✅✅ OFAC list fetched`) + } catch (e) { + console.error(`❌❌❌ OFAC list NOT fetched`) + throw e + } +} + +;(async () => await fetchOfac())() diff --git a/packages/exceptions/src/types/modules.ts b/packages/exceptions/src/types/modules.ts index 12e703fde..5c1206a59 100644 --- a/packages/exceptions/src/types/modules.ts +++ b/packages/exceptions/src/types/modules.ts @@ -21,6 +21,7 @@ export enum ChainErrorModule { Wasm = 'chain-wasm', WasmX = 'chain-wasmx', Tendermint = 'chain-tendermint', + Permissions = 'chain-permissions' } export enum IndexerErrorModule { diff --git a/packages/sdk-ts/package.json b/packages/sdk-ts/package.json index 88225325e..1c48ceb49 100644 --- a/packages/sdk-ts/package.json +++ b/packages/sdk-ts/package.json @@ -19,6 +19,7 @@ }, "scripts": { "postinstall": "link-module-alias", + "fetch:ofac": "node --experimental-fetch ./../../etc/ofac.js", "build": "tsc --build --force tsconfig.build.json && tsc --build --force tsconfig.build.esm.json && yarn build:post && link-module-alias", "build:watch": "tsc --build -w tsconfig.build.json && tsc -w --build tsconfig.build.esm.json && yarn build:post && link-module-alias", "build:post": "shx cp ../../etc/stub/package.json.stub dist/cjs/package.json && shx cp ../../etc/stub/package.esm.json.stub dist/esm/package.json", diff --git a/packages/sdk-ts/src/client/chain/grpc/ChainGrpcPermissionsApi.spec.ts b/packages/sdk-ts/src/client/chain/grpc/ChainGrpcPermissionsApi.spec.ts index 4506effb6..ef68ff807 100644 --- a/packages/sdk-ts/src/client/chain/grpc/ChainGrpcPermissionsApi.spec.ts +++ b/packages/sdk-ts/src/client/chain/grpc/ChainGrpcPermissionsApi.spec.ts @@ -8,7 +8,6 @@ const endpoints = getNetworkEndpoints(Network.MainnetSentry) const chainGrpcPermissionsApi = new ChainGrpcPermissionsApi(endpoints.grpc) const injectiveAddress = mockFactory.injectiveAddress - describe('ChainGrpcPermissionsApi', () => { test('fetchModuleParams', async () => { try { @@ -57,7 +56,7 @@ describe('ChainGrpcPermissionsApi', () => { try { const response = await chainGrpcPermissionsApi.fetchAddressesByRole({ denom: INJ_DENOM, - role: "role", + role: 'role', }) expect(response).toBeDefined() @@ -70,7 +69,8 @@ describe('ChainGrpcPermissionsApi', () => { ) } catch (e) { console.error( - 'chainGrpcPermissionsApi.fetchAddressesByRoles => ' + (e as any).message, + 'chainGrpcPermissionsApi.fetchAddressesByRoles => ' + + (e as any).message, ) } }) @@ -116,7 +116,7 @@ describe('ChainGrpcPermissionsApi', () => { test('fetchVouchersForAddress', async () => { try { const response = await chainGrpcPermissionsApi.fetchVouchersForAddress({ - address: injectiveAddress + address: injectiveAddress, }) expect(response).toBeDefined() @@ -129,7 +129,8 @@ describe('ChainGrpcPermissionsApi', () => { ) } catch (e) { console.error( - 'chainGrpcPermissionsApi.fetchVouchersForAddress => ' + (e as any).message, + 'chainGrpcPermissionsApi.fetchVouchersForAddress => ' + + (e as any).message, ) } }) diff --git a/packages/sdk-ts/src/client/chain/grpc/ChainGrpcPermissionsApi.ts b/packages/sdk-ts/src/client/chain/grpc/ChainGrpcPermissionsApi.ts index 60bc90c8c..929c4d344 100644 --- a/packages/sdk-ts/src/client/chain/grpc/ChainGrpcPermissionsApi.ts +++ b/packages/sdk-ts/src/client/chain/grpc/ChainGrpcPermissionsApi.ts @@ -1,16 +1,17 @@ import { - GrpcUnaryRequestException, - UnspecifiedErrorCode, + GrpcUnaryRequestException, + UnspecifiedErrorCode, } from '@injectivelabs/exceptions' import { InjectivePermissionsV1Beta1Query } from '@injectivelabs/core-proto-ts' import BaseGrpcConsumer from '../../base/BaseGrpcConsumer' import { ChainGrpcPermissionsTransformer } from '../transformers' +import { ChainModule } from '../types' /** * @category Chain Grpc API */ export class ChainGrpcPermissionsApi extends BaseGrpcConsumer { - //protected module: string = ChainModule. + protected module: string = ChainModule.Permissions protected client: InjectivePermissionsV1Beta1Query.QueryClientImpl @@ -22,14 +23,9 @@ export class ChainGrpcPermissionsApi extends BaseGrpcConsumer { ) } - async fetchAddressesByRole({ - denom, - role, - }: { - denom: string - role: string - }) { - const request = InjectivePermissionsV1Beta1Query.QueryAddressesByRoleRequest.create() + async fetchAddressesByRole({ denom, role }: { denom: string; role: string }) { + const request = + InjectivePermissionsV1Beta1Query.QueryAddressesByRoleRequest.create() request.denom = denom request.role = role @@ -65,7 +61,8 @@ export class ChainGrpcPermissionsApi extends BaseGrpcConsumer { address: string denom: string }) { - const request = InjectivePermissionsV1Beta1Query.QueryAddressRolesRequest.create() + const request = + InjectivePermissionsV1Beta1Query.QueryAddressRolesRequest.create() request.address = address request.denom = denom @@ -95,12 +92,13 @@ export class ChainGrpcPermissionsApi extends BaseGrpcConsumer { } async fetchAllNamespaces() { - const request = InjectivePermissionsV1Beta1Query.QueryAllNamespacesRequest.create() + const request = + InjectivePermissionsV1Beta1Query.QueryAllNamespacesRequest.create() try { const response = - await this.retry(() => - this.client.AllNamespaces(request, this.metadata), + await this.retry( + () => this.client.AllNamespaces(request, this.metadata), ) return ChainGrpcPermissionsTransformer.allNamespacesResponseToAllNamespaces( @@ -126,8 +124,8 @@ export class ChainGrpcPermissionsApi extends BaseGrpcConsumer { try { const response = - await this.retry(() => - this.client.Params(request, this.metadata), + await this.retry( + () => this.client.Params(request, this.metadata), ) return ChainGrpcPermissionsTransformer.moduleParamsResponseToModuleParams( @@ -155,7 +153,8 @@ export class ChainGrpcPermissionsApi extends BaseGrpcConsumer { denom: string includeRoles: boolean }) { - const request = InjectivePermissionsV1Beta1Query.QueryNamespaceByDenomRequest.create() + const request = + InjectivePermissionsV1Beta1Query.QueryNamespaceByDenomRequest.create() request.denom = denom request.includeRoles = includeRoles @@ -184,12 +183,9 @@ export class ChainGrpcPermissionsApi extends BaseGrpcConsumer { } } - async fetchVouchersForAddress({ - address, - }: { - address: string - }) { - const request = InjectivePermissionsV1Beta1Query.QueryVouchersForAddressRequest.create() + async fetchVouchersForAddress({ address }: { address: string }) { + const request = + InjectivePermissionsV1Beta1Query.QueryVouchersForAddressRequest.create() request.address = address diff --git a/packages/sdk-ts/src/client/chain/transformers/ChainGrpcPermissionsTransformer.ts b/packages/sdk-ts/src/client/chain/transformers/ChainGrpcPermissionsTransformer.ts index b3e4c7a6f..4c339b674 100644 --- a/packages/sdk-ts/src/client/chain/transformers/ChainGrpcPermissionsTransformer.ts +++ b/packages/sdk-ts/src/client/chain/transformers/ChainGrpcPermissionsTransformer.ts @@ -1,79 +1,81 @@ import { - Namespace, - PermissionsModuleParams, - GrpcPermissionsNamespace, -} from '../types/permissions'; -import { InjectivePermissionsV1Beta1Query } from '@injectivelabs/core-proto-ts'; + Namespace, + PermissionsModuleParams, + GrpcPermissionsNamespace, +} from '../types/permissions' +import { InjectivePermissionsV1Beta1Query } from '@injectivelabs/core-proto-ts' /** * @category Chain Grpc Transformer */ export class ChainGrpcPermissionsTransformer { - static moduleParamsResponseToModuleParams( - response: InjectivePermissionsV1Beta1Query.QueryParamsResponse, - ): PermissionsModuleParams { - const params = response.params! + static moduleParamsResponseToModuleParams( + response: InjectivePermissionsV1Beta1Query.QueryParamsResponse, + ): PermissionsModuleParams { + const params = response.params! - return { - wasmHookQueryMaxGas: params.wasmHookQueryMaxGas, - } + return { + wasmHookQueryMaxGas: params.wasmHookQueryMaxGas, } + } - static grpcNamespaceToNamespace ( - grpcNamespace: GrpcPermissionsNamespace, - ): Namespace { - return { - denom: grpcNamespace.denom, - wasmHook: grpcNamespace.wasmHook, - mintsPaused: grpcNamespace.mintsPaused, - sendsPaused: grpcNamespace.sendsPaused, - burnsPaused: grpcNamespace.burnsPaused, - rolePermissions: grpcNamespace.rolePermissions, - addressRoles: grpcNamespace.addressRoles, - } + static grpcNamespaceToNamespace( + grpcNamespace: GrpcPermissionsNamespace, + ): Namespace { + return { + denom: grpcNamespace.denom, + wasmHook: grpcNamespace.wasmHook, + mintsPaused: grpcNamespace.mintsPaused, + sendsPaused: grpcNamespace.sendsPaused, + burnsPaused: grpcNamespace.burnsPaused, + rolePermissions: grpcNamespace.rolePermissions, + addressRoles: grpcNamespace.addressRoles, } + } - static addressRolesResponseToAddressRoles( - response: InjectivePermissionsV1Beta1Query.QueryAddressRolesResponse, - ){ - return response.roles.map((role) => { - return { - roles: role, - } - }) - } + static addressRolesResponseToAddressRoles( + response: InjectivePermissionsV1Beta1Query.QueryAddressRolesResponse, + ) { + return response.roles.map((role) => { + return { + roles: role, + } + }) + } - static addressesByRolesResponseToAddressesByRoles ( - response: InjectivePermissionsV1Beta1Query.QueryAddressesByRoleResponse, - ){ - return response.addresses.map((address) => { - return { - addresses: address, - } - }) - } + static addressesByRolesResponseToAddressesByRoles( + response: InjectivePermissionsV1Beta1Query.QueryAddressesByRoleResponse, + ) { + return response.addresses.map((address) => { + return { + addresses: address, + } + }) + } - static allNamespacesResponseToAllNamespaces ( - response: InjectivePermissionsV1Beta1Query.QueryAllNamespacesResponse, - ) { - return response.namespaces.map((namespace) => { - ChainGrpcPermissionsTransformer.grpcNamespaceToNamespace(namespace) - }) - } + static allNamespacesResponseToAllNamespaces( + response: InjectivePermissionsV1Beta1Query.QueryAllNamespacesResponse, + ) { + return response.namespaces.map((namespace) => { + ChainGrpcPermissionsTransformer.grpcNamespaceToNamespace(namespace) + }) + } - static namespaceByDenomResponceToNamespaceByDenom ( - response: InjectivePermissionsV1Beta1Query.QueryNamespaceByDenomResponse, - ) { - return ChainGrpcPermissionsTransformer.grpcNamespaceToNamespace(response.namespace!) - } + static namespaceByDenomResponceToNamespaceByDenom( + response: InjectivePermissionsV1Beta1Query.QueryNamespaceByDenomResponse, + ) { + return ChainGrpcPermissionsTransformer.grpcNamespaceToNamespace( + response.namespace!, + ) + } - static vouchersForAddressResponseToVouchersForAddress ( - response: InjectivePermissionsV1Beta1Query.QueryVouchersForAddressResponse, - ) { - return response.vouchers.map((voucher) => { - return { - vouchers: voucher, - } - }) - } + static vouchersForAddressResponseToVouchersForAddress( + response: InjectivePermissionsV1Beta1Query.QueryVouchersForAddressResponse, + ) { + return response.vouchers.map((voucher) => { + return { + vouchers: voucher, + } + }) + } } diff --git a/packages/sdk-ts/src/client/chain/types/permissions.ts b/packages/sdk-ts/src/client/chain/types/permissions.ts index d68f6470a..fece2516b 100644 --- a/packages/sdk-ts/src/client/chain/types/permissions.ts +++ b/packages/sdk-ts/src/client/chain/types/permissions.ts @@ -1,55 +1,56 @@ import { - InjectivePermissionsV1Beta1Exchange, - InjectivePermissionsV1Beta1Params - } from '@injectivelabs/core-proto-ts' + InjectivePermissionsV1Beta1Permissions, + InjectivePermissionsV1Beta1Params, +} from '@injectivelabs/core-proto-ts' import { Coin } from '@injectivelabs/ts-types' - export interface Namespace { - denom: string - wasmHook: string - mintsPaused: boolean - sendsPaused: boolean - burnsPaused: boolean - rolePermissions: Role[] - addressRoles: AddressRoles[] - - } - - export interface PermissionsModuleParams { - wasmHookQueryMaxGas: string - } - - - export interface AddressRoles { - address: string - roles: string[] - } - - - export interface Role { - role: string - permissions: number - } - - - export interface RoleIDs { - roleIds: number[] - } - - export interface Voucher { - coins: Coin[] - } - - export interface AddressVoucher { - address: string - voucher?: Voucher - } - - export type GrpcPermissionsNamespace = InjectivePermissionsV1Beta1Exchange.Namespace - export type GrpcPermissionsAddressRoles = InjectivePermissionsV1Beta1Exchange.AddressRoles - export type GrpcPermissionsRole = InjectivePermissionsV1Beta1Exchange.Role - export type GrpcPermissionsRoleIDs = InjectivePermissionsV1Beta1Exchange.RoleIDs - export type GrpcPermissionsAddressVoucher = InjectivePermissionsV1Beta1Exchange.AddressVoucher - export type GrpcPermissionVoucher = InjectivePermissionsV1Beta1Exchange.Voucher - export type GrpcPermissionsParams = InjectivePermissionsV1Beta1Params.Params +export interface Namespace { + denom: string + wasmHook: string + mintsPaused: boolean + sendsPaused: boolean + burnsPaused: boolean + rolePermissions: Role[] + addressRoles: AddressRoles[] +} + +export interface PermissionsModuleParams { + wasmHookQueryMaxGas: string +} + +export interface AddressRoles { + address: string + roles: string[] +} + +export interface Role { + role: string + permissions: number +} + +export interface RoleIDs { + roleIds: number[] +} + +export interface Voucher { + coins: Coin[] +} + +export interface AddressVoucher { + address: string + voucher?: Voucher +} + +export type GrpcPermissionsNamespace = + InjectivePermissionsV1Beta1Permissions.Namespace +export type GrpcPermissionsAddressRoles = + InjectivePermissionsV1Beta1Permissions.AddressRoles +export type GrpcPermissionsRole = InjectivePermissionsV1Beta1Permissions.Role +export type GrpcPermissionsRoleIDs = + InjectivePermissionsV1Beta1Permissions.RoleIDs +export type GrpcPermissionsAddressVoucher = + InjectivePermissionsV1Beta1Permissions.AddressVoucher +export type GrpcPermissionVoucher = + InjectivePermissionsV1Beta1Permissions.Voucher +export type GrpcPermissionsParams = InjectivePermissionsV1Beta1Params.Params diff --git a/packages/sdk-ts/src/core/modules/permissions/index.ts b/packages/sdk-ts/src/core/modules/permissions/index.ts index 8a82869f8..fc6aba2fe 100644 --- a/packages/sdk-ts/src/core/modules/permissions/index.ts +++ b/packages/sdk-ts/src/core/modules/permissions/index.ts @@ -1,17 +1,17 @@ -import MsgClaimVoucher from "./msgs/MsgClaimVoucher"; -import MsgCreateNamespace from "./msgs/MsgCreateNamespace"; -import MsgDeleteNamespace from "./msgs/MsgDeleteNamespace"; -import MsgRevokeNamespaceRoles from "./msgs/MsgRevokeNamespaceRoles"; -import MsgUpdateNamespace from "./msgs/MsgUpdateNamespace"; -import MsgUpdateNamespaceRoles from "./msgs/MsgUpdateNamespaceRoles"; -import MsgUpdateParams from "./msgs/MsgUpdateParams"; +import MsgClaimVoucher from './msgs/MsgClaimVoucher' +import MsgCreateNamespace from './msgs/MsgCreateNamespace' +import MsgDeleteNamespace from './msgs/MsgDeleteNamespace' +import MsgRevokeNamespaceRoles from './msgs/MsgRevokeNamespaceRoles' +import MsgUpdateNamespace from './msgs/MsgUpdateNamespace' +import MsgUpdateNamespaceRoles from './msgs/MsgUpdateNamespaceRoles' +import MsgUpdateParams from './msgs/MsgUpdateParams' export { - MsgClaimVoucher, - MsgCreateNamespace, - MsgDeleteNamespace, - MsgRevokeNamespaceRoles, - MsgUpdateNamespace, - MsgUpdateNamespaceRoles, - MsgUpdateParams -}; + MsgClaimVoucher, + MsgCreateNamespace, + MsgDeleteNamespace, + MsgRevokeNamespaceRoles, + MsgUpdateNamespace, + MsgUpdateNamespaceRoles, + MsgUpdateParams, +} diff --git a/packages/sdk-ts/src/core/modules/permissions/msgs/MsgClaimVoucher.ts b/packages/sdk-ts/src/core/modules/permissions/msgs/MsgClaimVoucher.ts index 441c8d9e7..ca0e7d06f 100644 --- a/packages/sdk-ts/src/core/modules/permissions/msgs/MsgClaimVoucher.ts +++ b/packages/sdk-ts/src/core/modules/permissions/msgs/MsgClaimVoucher.ts @@ -1,6 +1,6 @@ -import { MsgBase } from '../../MsgBase'; -import snakecaseKeys from 'snakecase-keys'; -import { InjectivePermissionsV1Beta1Tx } from '@injectivelabs/core-proto-ts'; +import { MsgBase } from '../../MsgBase' +import snakecaseKeys from 'snakecase-keys' +import { InjectivePermissionsV1Beta1Tx } from '@injectivelabs/core-proto-ts' export declare namespace MsgClaimVoucher { export interface Params { @@ -8,7 +8,6 @@ export declare namespace MsgClaimVoucher { denom: string } - export type Proto = InjectivePermissionsV1Beta1Tx.MsgClaimVoucher } @@ -19,9 +18,7 @@ export default class MsgClaimVoucher extends MsgBase< MsgClaimVoucher.Params, MsgClaimVoucher.Proto > { - static fromJSON( - params: MsgClaimVoucher.Params, - ): MsgClaimVoucher { + static fromJSON(params: MsgClaimVoucher.Params): MsgClaimVoucher { return new MsgClaimVoucher(params) } @@ -32,9 +29,7 @@ export default class MsgClaimVoucher extends MsgBase< message.sender = params.sender message.denom = params.denom - return InjectivePermissionsV1Beta1Tx.MsgClaimVoucher.fromPartial( - message, - ) + return InjectivePermissionsV1Beta1Tx.MsgClaimVoucher.fromPartial(message) } public toData() { @@ -59,7 +54,7 @@ export default class MsgClaimVoucher extends MsgBase< } public toWeb3() { - const amino = this.toAmino(); + const amino = this.toAmino() const { value } = amino return { diff --git a/packages/sdk-ts/src/core/modules/permissions/msgs/MsgCreateNamespace.spec.ts b/packages/sdk-ts/src/core/modules/permissions/msgs/MsgCreateNamespace.spec.ts index b1d582b68..cc11edf28 100644 --- a/packages/sdk-ts/src/core/modules/permissions/msgs/MsgCreateNamespace.spec.ts +++ b/packages/sdk-ts/src/core/modules/permissions/msgs/MsgCreateNamespace.spec.ts @@ -11,8 +11,10 @@ const params: MsgCreateNamespace['params'] = { sendsPaused: false, burnsPaused: true, rolePermissions: [{ role: 'admin', permissions: 1 }], - addressRoles: [{ address: mockFactory.injectiveAddress2, roles: ['admin'] }], - } + addressRoles: [ + { address: mockFactory.injectiveAddress2, roles: ['admin'] }, + ], + }, } const protoType = '/injective.permissions.v1beta1.MsgCreateNamespace' diff --git a/packages/sdk-ts/src/core/modules/permissions/msgs/MsgCreateNamespace.ts b/packages/sdk-ts/src/core/modules/permissions/msgs/MsgCreateNamespace.ts index 64ba8fe4d..207af008e 100644 --- a/packages/sdk-ts/src/core/modules/permissions/msgs/MsgCreateNamespace.ts +++ b/packages/sdk-ts/src/core/modules/permissions/msgs/MsgCreateNamespace.ts @@ -1,18 +1,18 @@ -import { MsgBase } from '../../MsgBase'; -import snakecaseKeys from 'snakecase-keys'; -import { InjectivePermissionsV1Beta1Tx } from '@injectivelabs/core-proto-ts' +import { MsgBase } from '../../MsgBase' +import snakecaseKeys from 'snakecase-keys' +import { InjectivePermissionsV1Beta1Tx } from '@injectivelabs/core-proto-ts' export declare namespace MsgCreateNamespace { export interface Params { - sender: string; + sender: string namespace: { - denom: string; - wasmHook: string; - mintsPaused: boolean; - sendsPaused: boolean; - burnsPaused: boolean; - rolePermissions: { role: string; permissions: number }[]; - addressRoles: { address: string; roles: string[] }[]; + denom: string + wasmHook: string + mintsPaused: boolean + sendsPaused: boolean + burnsPaused: boolean + rolePermissions: { role: string; permissions: number }[] + addressRoles: { address: string; roles: string[] }[] } } @@ -26,69 +26,64 @@ export default class MsgCreateNamespace extends MsgBase< MsgCreateNamespace.Params, MsgCreateNamespace.Proto > { - static fromJSON( - params: MsgCreateNamespace.Params - ): MsgCreateNamespace { - return new MsgCreateNamespace(params); + static fromJSON(params: MsgCreateNamespace.Params): MsgCreateNamespace { + return new MsgCreateNamespace(params) } public toProto() { - const { params } = this; + const { params } = this const message = InjectivePermissionsV1Beta1Tx.MsgCreateNamespace.create() message.sender = params.sender message.namespace = params.namespace - return InjectivePermissionsV1Beta1Tx.MsgCreateNamespace.fromPartial( - message, - ) + return InjectivePermissionsV1Beta1Tx.MsgCreateNamespace.fromPartial(message) } public toData() { - const proto = this.toProto(); + const proto = this.toProto() return { '@type': '/injective.permissions.v1beta1.MsgCreateNamespace', ...proto, - }; + } } public toAmino() { - const proto = this.toProto(); + const proto = this.toProto() const message = { ...snakecaseKeys(proto), - }; + } return { type: 'permissions/MsgCreateNamespace', value: message, - }; + } } public toWeb3() { - const amino = this.toAmino(); - const { value } = amino; + const amino = this.toAmino() + const { value } = amino return { '@type': '/injective.permissions.v1beta1.MsgCreateNamespace', ...value, - }; + } } public toDirectSign() { - const proto = this.toProto(); + const proto = this.toProto() return { type: '/injective.permissions.v1beta1.MsgCreateNamespace', message: proto, - }; + } } public toBinary(): Uint8Array { return InjectivePermissionsV1Beta1Tx.MsgCreateNamespace.encode( this.toProto(), ).finish() - } } diff --git a/packages/sdk-ts/src/core/modules/permissions/msgs/MsgDeleteNamespace.spec.ts b/packages/sdk-ts/src/core/modules/permissions/msgs/MsgDeleteNamespace.spec.ts index bd2caf49d..7a7cf2054 100644 --- a/packages/sdk-ts/src/core/modules/permissions/msgs/MsgDeleteNamespace.spec.ts +++ b/packages/sdk-ts/src/core/modules/permissions/msgs/MsgDeleteNamespace.spec.ts @@ -7,8 +7,8 @@ const params: MsgDeleteNamespace['params'] = { namespaceDenom: 'namespace_denom', } -const protoType = '/injective.permissions.v1beta1.MsgDeleteNamespace'; -const protoTypeShort = 'permissions/MsgDeleteNamespace'; +const protoType = '/injective.permissions.v1beta1.MsgDeleteNamespace' +const protoTypeShort = 'permissions/MsgDeleteNamespace' const protoParams = { sender: params.sender, namespaceDenom: params.namespaceDenom, diff --git a/packages/sdk-ts/src/core/modules/permissions/msgs/MsgDeleteNamespace.ts b/packages/sdk-ts/src/core/modules/permissions/msgs/MsgDeleteNamespace.ts index 05d2b6215..84e84326a 100644 --- a/packages/sdk-ts/src/core/modules/permissions/msgs/MsgDeleteNamespace.ts +++ b/packages/sdk-ts/src/core/modules/permissions/msgs/MsgDeleteNamespace.ts @@ -1,11 +1,11 @@ -import { MsgBase } from '../../MsgBase'; -import snakecaseKeys from 'snakecase-keys'; -import { InjectivePermissionsV1Beta1Tx } from '@injectivelabs/core-proto-ts'; +import { MsgBase } from '../../MsgBase' +import snakecaseKeys from 'snakecase-keys' +import { InjectivePermissionsV1Beta1Tx } from '@injectivelabs/core-proto-ts' export declare namespace MsgDeleteNamespace { export interface Params { - sender: string; - namespaceDenom: string; + sender: string + namespaceDenom: string } export type Proto = InjectivePermissionsV1Beta1Tx.MsgDeleteNamespace @@ -18,63 +18,59 @@ export default class MsgDeleteNamespace extends MsgBase< MsgDeleteNamespace.Params, MsgDeleteNamespace.Proto > { - static fromJSON( - params: MsgDeleteNamespace.Params - ): MsgDeleteNamespace { - return new MsgDeleteNamespace(params); + static fromJSON(params: MsgDeleteNamespace.Params): MsgDeleteNamespace { + return new MsgDeleteNamespace(params) } public toProto() { - const { params } = this; + const { params } = this const message = InjectivePermissionsV1Beta1Tx.MsgDeleteNamespace.create() message.sender = params.sender message.namespaceDenom = params.namespaceDenom - return InjectivePermissionsV1Beta1Tx.MsgDeleteNamespace.fromPartial( - message, - ) + return InjectivePermissionsV1Beta1Tx.MsgDeleteNamespace.fromPartial(message) } public toData() { - const proto = this.toProto(); + const proto = this.toProto() return { '@type': '/injective.permissions.v1beta1.MsgDeleteNamespace', ...proto, - }; + } } public toAmino() { - const proto = this.toProto(); + const proto = this.toProto() const message = { ...snakecaseKeys(proto), - }; + } return { type: 'permissions/MsgDeleteNamespace', value: message, - }; + } } public toWeb3() { - const amino = this.toAmino(); - const { value } = amino; + const amino = this.toAmino() + const { value } = amino return { '@type': '/injective.permissions.v1beta1.MsgDeleteNamespace', ...value, - }; + } } public toDirectSign() { - const proto = this.toProto(); + const proto = this.toProto() return { type: '/injective.permissions.v1beta1.MsgDeleteNamespace', message: proto, - }; + } } public toBinary(): Uint8Array { diff --git a/packages/sdk-ts/src/core/modules/permissions/msgs/MsgRevokeNamespaceRoles.spec.ts b/packages/sdk-ts/src/core/modules/permissions/msgs/MsgRevokeNamespaceRoles.spec.ts index fbfe80528..8c1f5c5b0 100644 --- a/packages/sdk-ts/src/core/modules/permissions/msgs/MsgRevokeNamespaceRoles.spec.ts +++ b/packages/sdk-ts/src/core/modules/permissions/msgs/MsgRevokeNamespaceRoles.spec.ts @@ -5,7 +5,9 @@ import { mockFactory } from '@injectivelabs/test-utils' const params: MsgRevokeNamespaceRoles['params'] = { sender: mockFactory.injectiveAddress, namespaceDenom: 'namespace_denom', - addressRolesToRevoke: [{ address: mockFactory.injectiveAddress2, roles: ['admin'] }], + addressRolesToRevoke: [ + { address: mockFactory.injectiveAddress2, roles: ['admin'] }, + ], } const protoType = '/injective.permissions.v1beta1.MsgRevokeNamespaceRoles' @@ -27,7 +29,7 @@ describe('MsgRevokeNamespaceRoles', () => { const proto = message.toProto() expect(proto).toStrictEqual({ - ...protoParams + ...protoParams, }) }) diff --git a/packages/sdk-ts/src/core/modules/permissions/msgs/MsgRevokeNamespaceRoles.ts b/packages/sdk-ts/src/core/modules/permissions/msgs/MsgRevokeNamespaceRoles.ts index 887064228..9e5026aac 100644 --- a/packages/sdk-ts/src/core/modules/permissions/msgs/MsgRevokeNamespaceRoles.ts +++ b/packages/sdk-ts/src/core/modules/permissions/msgs/MsgRevokeNamespaceRoles.ts @@ -1,12 +1,12 @@ -import { MsgBase } from '../../MsgBase'; -import snakecaseKeys from 'snakecase-keys'; +import { MsgBase } from '../../MsgBase' +import snakecaseKeys from 'snakecase-keys' import { InjectivePermissionsV1Beta1Tx } from '@injectivelabs/core-proto-ts' export declare namespace MsgRevokeNamespaceRoles { export interface Params { - sender: string; - namespaceDenom: string; - addressRolesToRevoke: { address: string; roles: string[] }[]; + sender: string + namespaceDenom: string + addressRolesToRevoke: { address: string; roles: string[] }[] } export type Proto = InjectivePermissionsV1Beta1Tx.MsgRevokeNamespaceRoles @@ -20,15 +20,16 @@ export default class MsgRevokeNamespaceRoles extends MsgBase< MsgRevokeNamespaceRoles.Proto > { static fromJSON( - params: MsgRevokeNamespaceRoles.Params + params: MsgRevokeNamespaceRoles.Params, ): MsgRevokeNamespaceRoles { - return new MsgRevokeNamespaceRoles(params); + return new MsgRevokeNamespaceRoles(params) } public toProto() { - const { params } = this; + const { params } = this - const message = InjectivePermissionsV1Beta1Tx.MsgRevokeNamespaceRoles.create(); + const message = + InjectivePermissionsV1Beta1Tx.MsgRevokeNamespaceRoles.create() message.sender = params.sender message.namespaceDenom = params.namespaceDenom @@ -40,43 +41,43 @@ export default class MsgRevokeNamespaceRoles extends MsgBase< } public toData() { - const proto = this.toProto(); + const proto = this.toProto() return { '@type': '/injective.permissions.v1beta1.MsgRevokeNamespaceRoles', ...proto, - }; + } } public toAmino() { - const proto = this.toProto(); + const proto = this.toProto() const message = { ...snakecaseKeys(proto), - }; + } return { type: 'permissions/MsgRevokeNamespaceRoles', value: message, - }; + } } public toWeb3() { - const amino = this.toAmino(); - const { value } = amino; + const amino = this.toAmino() + const { value } = amino return { '@type': '/injective.permissions.v1beta1.MsgRevokeNamespaceRoles', ...value, - }; + } } public toDirectSign() { - const proto = this.toProto(); + const proto = this.toProto() return { type: '/injective.permissions.v1beta1.MsgRevokeNamespaceRoles', message: proto, - }; + } } public toBinary(): Uint8Array { diff --git a/packages/sdk-ts/src/core/modules/permissions/msgs/MsgUpdateNamespace.spec.ts b/packages/sdk-ts/src/core/modules/permissions/msgs/MsgUpdateNamespace.spec.ts index 0e92c4a69..ec22288b2 100644 --- a/packages/sdk-ts/src/core/modules/permissions/msgs/MsgUpdateNamespace.spec.ts +++ b/packages/sdk-ts/src/core/modules/permissions/msgs/MsgUpdateNamespace.spec.ts @@ -16,7 +16,7 @@ const params: MsgUpdateNamespace['params'] = { }, burnsPaused: { newValue: true, - } + }, } const protoType = '/injective.permissions.v1beta1.MsgUpdateNamespace' @@ -46,7 +46,7 @@ describe('MsgUpdateNamespace', () => { const proto = message.toProto() expect(proto).toStrictEqual({ - ...protoParams + ...protoParams, }) }) diff --git a/packages/sdk-ts/src/core/modules/permissions/msgs/MsgUpdateNamespace.ts b/packages/sdk-ts/src/core/modules/permissions/msgs/MsgUpdateNamespace.ts index 366459a21..8426e9084 100644 --- a/packages/sdk-ts/src/core/modules/permissions/msgs/MsgUpdateNamespace.ts +++ b/packages/sdk-ts/src/core/modules/permissions/msgs/MsgUpdateNamespace.ts @@ -1,22 +1,22 @@ -import { MsgBase } from '../../MsgBase'; -import snakecaseKeys from 'snakecase-keys'; -import { InjectivePermissionsV1Beta1Tx } from '@injectivelabs/core-proto-ts'; +import { MsgBase } from '../../MsgBase' +import snakecaseKeys from 'snakecase-keys' +import { InjectivePermissionsV1Beta1Tx } from '@injectivelabs/core-proto-ts' export declare namespace MsgUpdateNamespace { export interface Params { - sender: string; - namespaceDenom: string; + sender: string + namespaceDenom: string wasmHook: { - newValue: string; + newValue: string } mintsPaused: { - newValue: boolean; + newValue: boolean } sendsPaused: { - newValue: boolean; + newValue: boolean } burnsPaused: { - newValue: boolean; + newValue: boolean } } @@ -30,14 +30,12 @@ export default class MsgUpdateNamespace extends MsgBase< MsgUpdateNamespace.Params, MsgUpdateNamespace.Proto > { - static fromJSON( - params: MsgUpdateNamespace.Params - ): MsgUpdateNamespace { - return new MsgUpdateNamespace(params); + static fromJSON(params: MsgUpdateNamespace.Params): MsgUpdateNamespace { + return new MsgUpdateNamespace(params) } public toProto() { - const { params } = this; + const { params } = this const message = InjectivePermissionsV1Beta1Tx.MsgUpdateNamespace.create() message.sender = params.sender @@ -48,56 +46,54 @@ export default class MsgUpdateNamespace extends MsgBase< message.mintsPaused = { newValue: params.mintsPaused.newValue, } - message.sendsPaused = { + message.sendsPaused = { newValue: params.sendsPaused.newValue, } message.burnsPaused = { - newValue: params.burnsPaused.newValue, + newValue: params.burnsPaused.newValue, } - return InjectivePermissionsV1Beta1Tx.MsgUpdateNamespace.fromPartial( - message, - ) + return InjectivePermissionsV1Beta1Tx.MsgUpdateNamespace.fromPartial(message) } public toData() { - const proto = this.toProto(); + const proto = this.toProto() return { '@type': '/injective.permissions.v1beta1.MsgUpdateNamespace', ...proto, - }; + } } public toAmino() { - const proto = this.toProto(); + const proto = this.toProto() const message = { ...snakecaseKeys(proto), - }; + } return { type: 'permissions/MsgUpdateNamespace', value: message, - }; + } } public toWeb3() { - const amino = this.toAmino(); - const { value } = amino; + const amino = this.toAmino() + const { value } = amino return { '@type': '/injective.permissions.v1beta1.MsgUpdateNamespace', ...value, - }; + } } public toDirectSign() { - const proto = this.toProto(); + const proto = this.toProto() return { type: '/injective.permissions.v1beta1.MsgUpdateNamespace', message: proto, - }; + } } public toBinary(): Uint8Array { diff --git a/packages/sdk-ts/src/core/modules/permissions/msgs/MsgUpdateNamespaceRoles.spec.ts b/packages/sdk-ts/src/core/modules/permissions/msgs/MsgUpdateNamespaceRoles.spec.ts index 7b4c60d9f..c7a5b136c 100644 --- a/packages/sdk-ts/src/core/modules/permissions/msgs/MsgUpdateNamespaceRoles.spec.ts +++ b/packages/sdk-ts/src/core/modules/permissions/msgs/MsgUpdateNamespaceRoles.spec.ts @@ -32,7 +32,7 @@ describe('MsgUpdateNamespaceRoles', () => { const proto = message.toProto() expect(proto).toStrictEqual({ - ...protoParams + ...protoParams, }) }) diff --git a/packages/sdk-ts/src/core/modules/permissions/msgs/MsgUpdateNamespaceRoles.ts b/packages/sdk-ts/src/core/modules/permissions/msgs/MsgUpdateNamespaceRoles.ts index a96767794..8fd5c7a37 100644 --- a/packages/sdk-ts/src/core/modules/permissions/msgs/MsgUpdateNamespaceRoles.ts +++ b/packages/sdk-ts/src/core/modules/permissions/msgs/MsgUpdateNamespaceRoles.ts @@ -1,13 +1,13 @@ -import { MsgBase } from '../../MsgBase'; -import snakecaseKeys from 'snakecase-keys'; +import { MsgBase } from '../../MsgBase' +import snakecaseKeys from 'snakecase-keys' import { InjectivePermissionsV1Beta1Tx } from '@injectivelabs/core-proto-ts' export declare namespace MsgUpdateNamespaceRoles { export interface Params { - sender: string; - namespaceDenom: string; - rolePermissions: { role: string; permissions: number }[]; - addressRoles: { address: string; roles: string[] }[]; + sender: string + namespaceDenom: string + rolePermissions: { role: string; permissions: number }[] + addressRoles: { address: string; roles: string[] }[] } export type Proto = InjectivePermissionsV1Beta1Tx.MsgUpdateNamespaceRoles @@ -21,15 +21,16 @@ export default class MsgUpdateNamespaceRoles extends MsgBase< MsgUpdateNamespaceRoles.Proto > { static fromJSON( - params: MsgUpdateNamespaceRoles.Params + params: MsgUpdateNamespaceRoles.Params, ): MsgUpdateNamespaceRoles { - return new MsgUpdateNamespaceRoles(params); + return new MsgUpdateNamespaceRoles(params) } public toProto() { - const { params } = this; + const { params } = this - const message = InjectivePermissionsV1Beta1Tx.MsgUpdateNamespaceRoles.create(); + const message = + InjectivePermissionsV1Beta1Tx.MsgUpdateNamespaceRoles.create() message.sender = params.sender message.namespaceDenom = params.namespaceDenom @@ -42,43 +43,43 @@ export default class MsgUpdateNamespaceRoles extends MsgBase< } public toData() { - const proto = this.toProto(); + const proto = this.toProto() return { '@type': '/injective.permissions.v1beta1.MsgUpdateNamespaceRoles', ...proto, - }; + } } public toAmino() { - const proto = this.toProto(); + const proto = this.toProto() const message = { ...snakecaseKeys(proto), - }; + } return { type: 'permissions/MsgUpdateNamespaceRoles', value: message, - }; + } } public toWeb3() { - const amino = this.toAmino(); - const { value } = amino; + const amino = this.toAmino() + const { value } = amino return { '@type': '/injective.permissions.v1beta1.MsgUpdateNamespaceRoles', ...value, - }; + } } public toDirectSign() { - const proto = this.toProto(); + const proto = this.toProto() return { type: '/injective.permissions.v1beta1.MsgUpdateNamespaceRoles', message: proto, - }; + } } public toBinary(): Uint8Array { diff --git a/packages/sdk-ts/src/core/modules/permissions/msgs/MsgUpdateParams.ts b/packages/sdk-ts/src/core/modules/permissions/msgs/MsgUpdateParams.ts index fba679cf2..2fe5e320a 100644 --- a/packages/sdk-ts/src/core/modules/permissions/msgs/MsgUpdateParams.ts +++ b/packages/sdk-ts/src/core/modules/permissions/msgs/MsgUpdateParams.ts @@ -1,17 +1,15 @@ -import { MsgBase } from '../../MsgBase'; -import snakecaseKeys from 'snakecase-keys'; -import { InjectivePermissionsV1Beta1Tx } from '@injectivelabs/core-proto-ts'; - +import { MsgBase } from '../../MsgBase' +import snakecaseKeys from 'snakecase-keys' +import { InjectivePermissionsV1Beta1Tx } from '@injectivelabs/core-proto-ts' export declare namespace MsgUpdateParams { export interface Params { - authority: string; + authority: string params: { - wasmHookQueryMaxGas: string; - }; + wasmHookQueryMaxGas: string + } } - export type Proto = InjectivePermissionsV1Beta1Tx.MsgUpdateParams } @@ -22,67 +20,63 @@ export default class MsgUpdateParams extends MsgBase< MsgUpdateParams.Params, MsgUpdateParams.Proto > { - static fromJSON( - params: MsgUpdateParams.Params, - ): MsgUpdateParams { - return new MsgUpdateParams(params); + static fromJSON(params: MsgUpdateParams.Params): MsgUpdateParams { + return new MsgUpdateParams(params) } public toProto() { - const { params } = this; + const { params } = this const message = InjectivePermissionsV1Beta1Tx.MsgUpdateParams.create() message.authority = params.authority message.params = params.params - return InjectivePermissionsV1Beta1Tx.MsgUpdateParams.fromPartial( - message, - ) + return InjectivePermissionsV1Beta1Tx.MsgUpdateParams.fromPartial(message) } public toData() { - const proto = this.toProto(); + const proto = this.toProto() return { '@type': '/injective.permissions.v1beta1.MsgUpdateParams', ...proto, - }; + } } public toAmino() { - const proto = this.toProto(); + const proto = this.toProto() const message = { ...snakecaseKeys(proto), - }; + } return { type: 'permissions/MsgUpdateParams', value: message, - }; + } } public toWeb3() { - const amino = this.toAmino(); - const { value } = amino; + const amino = this.toAmino() + const { value } = amino return { '@type': '/injective.permissions.v1beta1.MsgUpdateParams', ...value, - }; + } } public toDirectSign() { - const proto = this.toProto(); + const proto = this.toProto() return { type: '/injective.permissions.v1beta1.MsgUpdateParams', message: proto, - }; + } } public toBinary(): Uint8Array { - return InjectivePermissionsV1Beta1Tx.MsgUpdateParams.encode( - this.toProto(), - ).finish() + return InjectivePermissionsV1Beta1Tx.MsgUpdateParams.encode( + this.toProto(), + ).finish() } } diff --git a/packages/sdk-ts/src/core/modules/tx/broadcaster/MsgBroadcasterWithPk.ts b/packages/sdk-ts/src/core/modules/tx/broadcaster/MsgBroadcasterWithPk.ts index 060f5d822..305a08f9f 100644 --- a/packages/sdk-ts/src/core/modules/tx/broadcaster/MsgBroadcasterWithPk.ts +++ b/packages/sdk-ts/src/core/modules/tx/broadcaster/MsgBroadcasterWithPk.ts @@ -25,6 +25,7 @@ import { CreateTransactionArgs } from '../types' import { IndexerGrpcTransactionApi } from '../../../../client' import { AccountDetails } from '../../../../types/auth' import { CosmosTxV1Beta1Tx } from '@injectivelabs/core-proto-ts' +import { ofacWallets } from './../../../../json' interface MsgBroadcasterTxOptions { msgs: Msgs | Msgs[] @@ -104,6 +105,14 @@ export class MsgBroadcasterWithPk { * @returns {string} transaction hash */ async broadcast(transaction: MsgBroadcasterTxOptions) { + const { privateKey } = this + + if (ofacWallets.includes(privateKey.toHex())) { + throw new GeneralException( + new Error('You cannot execute this transaction'), + ) + } + const { txRaw } = await this.prepareTxForBroadcast(transaction) return await this.broadcastTxRaw(txRaw) @@ -117,6 +126,15 @@ export class MsgBroadcasterWithPk { */ async broadcastWithFeeDelegation(transaction: MsgBroadcasterTxOptions) { const { simulateTx, privateKey, ethereumChainId, endpoints } = this + + const ethereumWallet = this.privateKey.toHex() + + if (ofacWallets.includes(ethereumWallet)) { + throw new GeneralException( + new Error('You cannot execute this transaction'), + ) + } + const msgs = Array.isArray(transaction.msgs) ? transaction.msgs : [transaction.msgs] @@ -164,6 +182,15 @@ export class MsgBroadcasterWithPk { */ async simulate(transaction: MsgBroadcasterTxOptions) { const { privateKey, endpoints, chainId } = this + + const ethereumWallet = this.privateKey.toHex() + + if (ofacWallets.includes(ethereumWallet)) { + throw new GeneralException( + new Error('You cannot execute this transaction'), + ) + } + const tx = { ...transaction, msgs: Array.isArray(transaction.msgs) diff --git a/packages/sdk-ts/src/index.ts b/packages/sdk-ts/src/index.ts index 81d16d1c3..e7e201989 100644 --- a/packages/sdk-ts/src/index.ts +++ b/packages/sdk-ts/src/index.ts @@ -3,3 +3,4 @@ export * from './client' export * from './utils' export * from './service' export * from './types' +export * from './json' diff --git a/packages/sdk-ts/src/json/index.ts b/packages/sdk-ts/src/json/index.ts new file mode 100644 index 000000000..00e3692a8 --- /dev/null +++ b/packages/sdk-ts/src/json/index.ts @@ -0,0 +1 @@ +export * from './ofac' diff --git a/packages/sdk-ts/src/json/ofac.ts b/packages/sdk-ts/src/json/ofac.ts new file mode 100644 index 000000000..94c73c9eb --- /dev/null +++ b/packages/sdk-ts/src/json/ofac.ts @@ -0,0 +1,48 @@ +export const ofacWallets = [ + "0x179f48c78f57a3a78f0608cc9197b8972921d1d2", + "0x1967d8af5bd86a497fb3dd7899a020e47560daaf", + "0x19aa5fe80d33a56d56c78e82ea5e50e5d80b4dff", + "0x19aa5fe80d33a56d56c78e82ea5e50e5d80b4dff", + "0x1da5821544e25c636c1417ba96ade4cf6d2f9b5a", + "0x2f389ce8bd8ff92de3402ffce4691d17fc4f6535", + "0x2f389ce8bd8ff92de3402ffce4691d17fc4f6535", + "0x2f50508a8a3d323b91336fa3ea6ae50e55f32185", + "0x308ed4b7b49797e1a98d3818bff6fe5385410370", + "0x3cbded43efdaf0fc77b9c55f6fc9988fcc9b757d", + "0x3efa30704d2b8bbac821307230376556cf8cc39e", + "0x48549a34ae37b12f6a30566245176994e17c6b4a", + "0x4f47bc496083c727c5fbe3ce9cdf2b0f6496270c", + "0x4f47bc496083c727c5fbe3ce9cdf2b0f6496270c", + "0x4f47bc496083c727c5fbe3ce9cdf2b0f6496270c", + "0x530a64c0ce595026a4a556b703644228179e2d57", + "0x5512d943ed1f7c8a43f3435c85f7ab68b30121b0", + "0x5a7a51bfb49f190e5a6060a5bc6052ac14a3b59f", + "0x5f48c2a71b2cc96e3f0ccae4e39318ff0dc375b2", + "0x6be0ae71e6c41f2f9d0d1a3b8d0f75e6f6a0b46e", + "0x6f1ca141a28907f78ebaa64fb83a9088b02a8352", + "0x746aebc06d2ae31b71ac51429a19d54e797878e9", + "0x77777feddddffc19ff86db637967013e6c6a116c", + "0x797d7ae72ebddcdea2a346c1834e04d1f8df102b", + "0x8576acc5c05d6ce88f4e49bf65bdf0c62f91353c", + "0x901bb9583b24d97e995513c6778dc6888ab6870e", + "0x961c5be54a2ffc17cf4cb021d863c42dacd47fc1", + "0x97b1043abd9e6fc31681635166d430a458d14f9c", + "0x9c2bc757b66f24d60f016b6237f8cdd414a879fa", + "0x9f4cda013e354b8fc285bf4b9a60460cee7f7ea9", + "0xa7e5d5a720f06526557c513402f2e6b5fa20b008", + "0xb6f5ec1a0a9cd1526536d3f0426c429529471f40", + "0xb6f5ec1a0a9cd1526536d3f0426c429529471f40", + "0xb6f5ec1a0a9cd1526536d3f0426c429529471f40", + "0xc455f7fd3e0e12afd51fba5c106909934d8a0e4a", + "0xca0840578f57fe71599d29375e16783424023357", + "0xd0975b32cea532eadddfc9c60481976e39db3472", + "0xd882cfc20f52f2599d84b8e8d58c7fb62cfe344b", + "0xd882cfc20f52f2599d84b8e8d58c7fb62cfe344b", + "0xe1d865c3d669dcc8c57c8d023140cb204e672ee4", + "0xe7aa314c77f4233c18c6cc84384a9247c0cf367b", + "0xed6e0a7e4ac94d976eebfb82ccf777a3c6bad921", + "0xf3701f445b6bdafedbca97d1e477357839e4120d", + "0xfac583c0cf07ea434052c49115a4682172ab6b4f", + "0xfec8a60023265364d066a1212fde3930f6ae8da7", + "0xffbac21a641dcfe4552920138d90f3638b3c9fba" +] \ No newline at end of file diff --git a/packages/wallet-ts/src/broadcaster/MsgBroadcaster.ts b/packages/wallet-ts/src/broadcaster/MsgBroadcaster.ts index ac4e0d0d1..64cf88027 100644 --- a/packages/wallet-ts/src/broadcaster/MsgBroadcaster.ts +++ b/packages/wallet-ts/src/broadcaster/MsgBroadcaster.ts @@ -5,6 +5,7 @@ import { SIGN_DIRECT, TxResponse, hexToBase64, + ofacWallets, SIGN_EIP712_V2, SIGN_EIP712, ChainGrpcAuthApi, @@ -144,6 +145,12 @@ export class MsgBroadcaster { ), } as MsgBroadcasterTxOptionsWithAddresses + if (ofacWallets.includes(txWithAddresses.ethereumAddress)) { + throw new GeneralException( + new Error('You cannot execute this transaction'), + ) + } + return isCosmosWallet(walletStrategy.wallet) ? this.broadcastCosmos(txWithAddresses) : isEip712V2OnlyWallet(walletStrategy.wallet) @@ -172,6 +179,12 @@ export class MsgBroadcaster { ), } as MsgBroadcasterTxOptionsWithAddresses + if (ofacWallets.includes(txWithAddresses.ethereumAddress)) { + throw new GeneralException( + new Error('You cannot execute this transaction'), + ) + } + return isCosmosWallet(walletStrategy.wallet) ? this.broadcastCosmos(txWithAddresses) : this.broadcastWeb3V2(txWithAddresses) @@ -200,6 +213,12 @@ export class MsgBroadcaster { ), } as MsgBroadcasterTxOptionsWithAddresses + if (ofacWallets.includes(txWithAddresses.ethereumAddress)) { + throw new GeneralException( + new Error('You cannot execute this transaction'), + ) + } + return isCosmosWallet(walletStrategy.wallet) ? this.broadcastCosmos(txWithAddresses) : this.broadcastWeb3WithFeeDelegation(txWithAddresses) @@ -225,6 +244,12 @@ export class MsgBroadcaster { ), } as MsgBroadcasterTxOptionsWithAddresses + if (ofacWallets.includes(txWithAddresses.ethereumAddress)) { + throw new GeneralException( + new Error('You cannot execute this transaction'), + ) + } + return isCosmosWallet(walletStrategy.wallet) ? this.broadcastCosmosWithFeeDelegation(txWithAddresses) : this.broadcastWeb3WithFeeDelegation(txWithAddresses)