canfoundation / cif-js

MIT License
2 stars 1 forks source link

[BUG] incorrect authorization actor in of create community action #68

Open danielvo11 opened 4 years ago

danielvo11 commented 4 years ago

/cc @manh-vv

danielvo11 commented 4 years ago

This is relative to https://git.baikal.io/can/cif-be/issues/29, so I am going to do this issue first!.

/cc @manh-vv

manh-vv commented 4 years ago

/cc @manh-vv

Quy could you elaborate on this issue.

danielvo11 commented 4 years ago

@manh-vv

Current situation:

Payer transfer token to create community for community creator generate the following actions:

createCommunity({
       community_account: "community1.c",
       community_name: "community test",
       community_url:"http://community.test",
       create_default_code: true,
       creator: "daniel111111",
       description: "community to test",
       member_badge: ["123"],
   }, 
  "10.0000 CAT", // initital CAT
  "ram.can"  // payer
);
{
   actions: [
          {
            account: "eosio.token"
            authorization: [{ actor: "daniel111111", permission: "active" }] // incorrect, it should be actor: "ram.can"
            data: { from: "ram.can", quantity: "10.0000 CAT", to: "governance", memo: "test" }
            name: "transfer"
          }
          {
            account: "governance"
            name: "create"
            authorization: [{ actor: "ram.can", permission: "active" }]
            data: {
              community_account: "community1.c"
              community_name: "test community"
              community_url: "http://community.test"
              create_default_code: true
              creator: "daniel111111"
              description: "community to test"
              member_badge: ["123"]
            }
          }
        ]
}

Expected result:

{
   actions: [
          {
            account: "eosio.token"
            authorization: [{ actor: "ram.can", permission: "active" }] 
            data: { from: "daniel", quantity: "10.0000 CAT", to: "governance", memo: "test" }
            name: "transfer"
          }
          {
            account: "governance"
            name: "create"
            authorization: [{ actor: "ram.can", permission: "active" }]
            data: {
              community_account: "community1.c"
              community_name: "test community"
              community_url: "http://community.test"
              create_default_code: true
              creator: "daniel111111"
              description: "community to test"
              member_badge: ["123"]
            }
          }
        ]
}