Skip to content

Commit

Permalink
feat: Add & export explicit return type definition for deployContract
Browse files Browse the repository at this point in the history
  • Loading branch information
wottpal committed Dec 12, 2023
1 parent d4c539d commit cf8e5f5
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/helpers/deployContract.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { DeployedContract } from '@/types'
import { ApiPromise } from '@polkadot/api'
import { CodePromise } from '@polkadot/api-contract'
import { ContractOptions } from '@polkadot/api-contract/types'
Expand All @@ -17,7 +18,7 @@ export const deployContract = async (
constructorMethod = 'new',
args = [] as unknown[],
options = {} as ContractOptions,
) => {
): Promise<DeployedContract> => {
return new Promise<{
address: string
hash: string
Expand Down
8 changes: 8 additions & 0 deletions src/types/DeployedContract.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import { SignedBlock } from '@polkadot/types/interfaces'

export interface DeployedContract {
address: string
hash: string
block: SignedBlock
blockNumber: number
}
1 change: 1 addition & 0 deletions src/types/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
// @index('./*.ts', f => `export * from '${f.path}'`)
export * from './ChainAsset'
export * from './DeployedContract'
export * from './SubstrateChain'
export * from './SubstrateDeployment'
export * from './SubstrateWallet'
Expand Down

0 comments on commit cf8e5f5

Please sign in to comment.