0xSplits / splits-sdk

An SDK for building apps on top of 0xSplits
https://docs.splits.org/sdk
MIT License
31 stars 11 forks source link

Documentation/sdk issues. #39

Closed actuallymentor closed 3 months ago

actuallymentor commented 4 months ago

Hello team!

I'm trying to get the sdk to work, but the documentation is confusing and seems to be full of errors. Due to the docs being unstable I am not sure if the contract reversions I am encountering are due to errors on my part or the sdk being broken. Could you please clarify if the examples below are intentional (and I am misunderstanding something fundamental) or whether I should consider these docs experimental/broken?

Aside from the below, the new SplitsClient now seems to return an object with a syntax that does not track with the docs, I had to const { splitV2: client } = new SplitsClient in order to get it to work.

Example use of ; instead of , here:

const args = {
  recipients: [
    {
      address: "0x442C01498ED8205bFD9aaB6B8cc5C810Ed070C8f";
      percentAllocation: 50.0000
    },
    {
      address: "0xc3313847E2c4A506893999f9d53d07cDa961a675";
      percentAllocation: 50.0000
    }
  ]
  distributorFeePercent: 1.0000
  controller: "0xEc8Bfc8637247cEe680444BA1E25fA5e151Ba342"
}

const response = await splitsClient.createSplit(args)

Example use of {} for an array instead of [] here:

const args = {
  splitAddress: "0x047ED5b8E8a7eDBd92FAF61f3117cAFE8c529ABb"
  recipients: {
    {
      address: "0x442C01498ED8205bFD9aaB6B8cc5C810Ed070C8f";
      percentAllocation: 50.0000
    },
    {
      address: "0xc3313847E2c4A506893999f9d53d07cDa961a675";
      percentAllocation: 50.0000
    },
  }
  distributorFeePercent: 1.0000
}

const response = await splitsClient.updateSplit(args)
actuallymentor commented 4 months ago

Please let me know if I can help with this. I'm going to give up on this sdk for now. I'm not managing to get any transactions to go through. For anyone landing here from Google, I recommend you import { SplitV1Client } from '@0xsplits/splits-sdk' if you are using a V1 splits.

But after that I run continuously into errors so can't help post that point.

mihoward21 commented 4 months ago

Hi @actuallymentor , thanks for the notes. Will get the docs cleaned up.

We accidentally published an alpha test version to npm. Have gone ahead and undone that. That was why the docs weren't matching up with the sdk. Thanks for flagging that for us!

I think with the proper version it should be working correctly, or giving more helpful error messages. But can help debug if you are still running into issues.