Skip to content

Commit

Permalink
Merge pull request #35 from Phala-Network/feat-save-package-info-on-u…
Browse files Browse the repository at this point in the history
…pload

feat: save package info when upload
  • Loading branch information
Leechael authored Feb 21, 2024
2 parents 3934536 + 093d018 commit ab552f6
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/commands/upload.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import fs from 'node:fs'
import upath from 'upath'
import type { u16 } from '@polkadot/types'
import {
getContract,
Expand All @@ -24,6 +25,13 @@ export default class Upload extends PhatBaseCommand {
const rpc = this.parsedFlags.rpc || process.env.MUMBAI_RPC_URL || process.env.POLYGON_RPC_URL || (await this.promptRpc())
const consumerAddress = this.parsedFlags.consumerAddress || (await this.promptConsumerAddress())

let derived = '[email protected]'
try {
const packageJson = JSON.parse(fs.readFileSync(upath.join(process.cwd(), 'package.json'), 'utf8'))
derived = `${packageJson.name}@${packageJson.version}`
} catch (err) {
}

const buildScriptPath = await this.buildOrGetScriptPath()

// connect to the endpoint
Expand Down Expand Up @@ -99,6 +107,7 @@ export default class Upload extends PhatBaseCommand {
config: {
codeHash: rollupAbi.info.source.wasmHash.toHex(),
callee: contract.address.toHex(),
package: derived,
selector,
input: [],
},
Expand Down

0 comments on commit ab552f6

Please sign in to comment.