Skip to content

Commit

Permalink
Fix: Add transfer to available functions (#161)
Browse files Browse the repository at this point in the history
* add transfer to available functions

* update changelog and package.json

* update subgraph url
  • Loading branch information
josemarinas authored Feb 21, 2023
1 parent b0b0021 commit 0f466bb
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 2 deletions.
4 changes: 4 additions & 0 deletions modules/client/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ TEMPLATE:
-->

## [0.21.2-beta]
### Fixed
- Add `transfer` to available functions

## [0.21.1-beta]
### Fixed
- `startDate` and `endDate` swapped on `getProposal` funtion of the multisig client
Expand Down
2 changes: 1 addition & 1 deletion modules/client/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@aragon/sdk-client",
"author": "Aragon Association",
"version": "0.21.1-beta",
"version": "0.21.2-beta",
"license": "MIT",
"main": "dist/index.js",
"module": "dist/sdk-client.esm.js",
Expand Down
4 changes: 4 additions & 0 deletions modules/client/src/internal/constants.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
import { DAO__factory } from "@aragon/core-contracts-ethers";
import { AddressZero } from "@ethersproject/constants";
import { Contract } from "@ethersproject/contracts";
import { DaoMetadata } from "../interfaces";
import { erc20ContractAbi } from "./abi/erc20";

export const AVAILABLE_FUNCTION_SIGNATURES: string[] = [
new Contract(AddressZero, erc20ContractAbi).interface.getFunction("transfer").format("minimal"),
DAO__factory.createInterface().getFunction("grant").format("minimal"),
DAO__factory.createInterface().getFunction("grantWithCondition").format("minimal"),
DAO__factory.createInterface().getFunction("revoke").format("minimal"),
Expand Down
20 changes: 20 additions & 0 deletions modules/client/test/integration/client/decoding.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -271,6 +271,26 @@ describe("Client", () => {
expect(iface?.hash).toBe("0xee57e36f");
});

it("Should get the function for a withdraw action data", async () => {
const context = new Context(contextParamsLocalChain);
const client = new Client(context);
const params: WithdrawParams = {
type: TokenType.ERC20,
amount: BigInt(1),
tokenAddress: "0x1234567890123456789012345678901234567890",
recipientAddressOrEns: "0x2345678901234567890123456789012345678901"
};

const updateDaoMetadataAction = await client.encoding
.withdrawAction(
params,
);
const iface = client.decoding.findInterface(updateDaoMetadataAction.data);
expect(iface?.id).toBe("function transfer(address,uint256) returns (bool)");
expect(iface?.functionName).toBe("transfer");
expect(iface?.hash).toBe("0xa9059cbb");
});

it("Should try to get the function of an invalid data and return null", async () => {
const context = new Context(contextParamsLocalChain);
const client = new Client(context);
Expand Down
2 changes: 1 addition & 1 deletion modules/client/test/integration/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ const grapqhlEndpoints = {
working: [
{
url:
"https://subgraph.satsuma-prod.com/qHR2wGfc5RLi6/aragon/core-goerli/version/v0.9.1-alpha-old-contr-sig/api",
"https://subgraph.satsuma-prod.com/qHR2wGfc5RLi6/aragon/core-goerli/api",
},
],
failing: [{ url: "https://bad-url-gateway.io/" }],
Expand Down

0 comments on commit 0f466bb

Please sign in to comment.