LIT-Protocol / Issues-and-Reports

For bug reports, feature requests, and implementation questions related to Lit Protocol and use of the Lit SDK.
0 stars 0 forks source link

getlit CLI still maintained and am I using it properly? #7

Open zach-is-my-name opened 8 months ago

zach-is-my-name commented 8 months ago

Is there an existing issue for this?

SDK version

Not relevant? But 3.2.*

Lit Network

Cayenne

Description of the bug/issue

getlit deploy errors out

[~/Projects/3-Idea/charli/apps/LitActions]$ erd
 LitActions
 ├─ .gitignore
 ├─ bun.lockb
 ├─ index.ts
 ├─ package.json
 ├─ tsconfig.json
 └─ lit_actions
    ├─ getlit.json
    ├─ globa.d.ts
    ├─ tsconfig.json
    ├─ utils.mjs
    ├─ src
    │  ├─ test.action.ts
    │  ├─ transferFrom_learner_to_controller.action.ts
    │  └─ transfer_controller_to_teacher.action.ts
    └─ test
       ├─ foo.t.action.mjs
       ├─ main.t.action.mjs
       ├─ test.t.action.mjs
       ├─ transferFrom_learner_to_controller.t.action.mjs
       └─ transfer_controller_to_teacher.t.action.mjs

3 directories, 17 files
[~/Projects/3-Idea/charli/apps/LitActions]$ getlit deploy
? Which action do you want to deploy? (Use arrow keys)
? Which action do you want to deploy? transferFrom_learner_to_controller
file:///home/zmg/.nvm/versions/node/v18.19.0/lib/node_modules/getlit/scripts/deploy.mjs:79
    redLog(`\n❌ Error deploying action file at ${actionFile}\n`);
                                                 ^

ReferenceError: actionFile is not defined
    at upload (file:///home/zmg/.nvm/versions/node/v18.19.0/lib/node_modules/getlit/scripts/deploy.mjs:79:50)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async Object.deployFunc [as fn] (file:///home/zmg/.nvm/versions/node/v18.19.0/lib/node_modules/getlit/scripts/deploy.mjs:29:18)

Node.js v18.19.0
[~/Projects/3-Idea/charli/apps/LitActions]$

Severity of the bug

Low. I'm just trying out GetLit

Steps To Reproduce

$ getlit init lit_actions
$ getlit new transferFrom_learner_to_controller
$ echo "import {ethers} from 'ethers'

  // let learnerAddress="0x"
  // let controllerAddress="0x"
  // let controllerPubKey="0x"
  // let paymentAmount=0
  // let usdcContractAddress="0x"
  // let chainId = 1

  // Above values should be dynamically passed to the Lit Action through executeJs

/**
 * NAME: transferFrom_learner_to_controller
 */

(async () => {
  const abi = [
    "function transferFrom(address sender, address recipient, uint256 amount) returns (boolean)"
  ];
  const latestNonce = await LitActions.getLatestNonce({
    address: controllerAddress,
    chain: "chronicle",
  });

  const contract = new ethers.Contract(usdcContractAddress, abi);

  const amount = ethers.parseUnits(paymentAmount.toString(), 6);

  const txData = contract.interface.encodeFunctionData("transferFrom", [learnerAddress, controllerAddress, amount]);

  const txObject = {
    "to": usdcContractAddress,
    "nonce": parseInt(latestNonce),
    "chainId": chainId,
    "gasLimit": "50000",
    "from": controllerAddress,
    "data": txData,
    "type": 2,
  };

  LitActions.setResponse({ response: JSON.stringify({ txObject }) });
  const tx = ethers.Transaction.from(txObject);
  const serializedTx = tx.unsignedSerialized;
  const rlpEncodedTxn = ethers.getBytes(serializedTx);
  const unsignedTxn = ethers.keccak256(rlpEncodedTxn);
  const toSign = ethers.getBytes(unsignedTxn);

  const sigShare = await LitActions.signEcdsa({
    toSign,
    publicKey: controllerPubKey,
    sigName: "sign_transfer_from",
  });

  console.log('Signature for transferFrom:', sigShare);
})();' > "
$ getlit build
$ getlit deploy

Link to code

Above

Anything else?

No response

bertrandbuild commented 7 months ago

@zach-is-my-name the cli seems out of date rn : https://github.com/LIT-Protocol/Issues-and-Reports/issues/18#issuecomment-2096595425