{"id":20177707,"url":"https://github.com/useverto/tippar","last_synced_at":"2025-03-03T05:23:59.779Z","repository":{"id":113351958,"uuid":"329735457","full_name":"useverto/tippar","owner":"useverto","description":"Recursive method to choose which profit-sharing token holder receives a tip.","archived":false,"fork":false,"pushed_at":"2021-01-15T05:59:07.000Z","size":22,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-02-14T07:17:56.822Z","etag":null,"topics":["arweave","profit-sharing","pst","tip","token"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/@verto/tippar","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/useverto.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-01-14T21:11:22.000Z","updated_at":"2021-01-15T07:58:27.000Z","dependencies_parsed_at":null,"dependency_job_id":"3edc24b2-51c1-4129-b257-ccc9c9614a11","html_url":"https://github.com/useverto/tippar","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/useverto%2Ftippar","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/useverto%2Ftippar/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/useverto%2Ftippar/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/useverto%2Ftippar/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/useverto","download_url":"https://codeload.github.com/useverto/tippar/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241612691,"owners_count":19990857,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["arweave","profit-sharing","pst","tip","token"],"created_at":"2024-11-14T02:17:04.619Z","updated_at":"2025-03-03T05:23:59.767Z","avatar_url":"https://github.com/useverto.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Tippar\n\nA simple library to select which PST token holder receives a tip. With the addition of SmartWeave contracts being able to custody different types of PSTs, there now needs to be a way for tips to be distributed to contracts in addition to wallets.\n\n## How it works\n\nTippar chooses token holders from contract(s) in recursion until a wallet is selected. Take note of the following examples:\n\n\u003e A tip needs to be given to a token holder in Contract A\n\n```\nTippar Process:\n\nselect holder from contract (A)\nif holder === contract (B)\n  select new holder from contract (B)\n  if new holder === wallet\n    return new holder\n  else\n    ...continue recursion\n```\n\n**Real-World Example:**\n\nAn ArDrive user is sending a tip to an ArDrive holder. If the random token-holder selected to receive the tip is the Verto Contract, a new token-holder is calculated from the users who hold a balance of VRT. This means that the ArDrive tip will now be sent to the VRT token holder.\n\n## Usage\n\n```shell script\nyarn add @verto/tippar\n```\n\n#### `chooseRecipient`\n\n```js\nasync function chooseRecipient(client: Arweave, contract: string, mode?: string): Promise\u003cstring\u003e\n```\n\n- `client`: Arweave client instance\n- `contract`: Profit-Sharing token contract to choose holder from\n- `mode?`: Optional parameter for setting type of selection\n  - \"weightedRandom\": Select token holder based on a weighted-random\n  - \"greatest\": Select token holder from the the greatest balance\n  - Defaults to \"weightedRandom\"\n\n**Example:**\n\n```js\nimport { chooseRecipient } from \"@verto/tippar;\n\nasync function someUserInteraction() {\n  ...\n  const tipReceiver = await chooseRecipient(arweaveClient, pstContract);\n  console.log(`Wallet of tip receiver: ${tipReceiver}`);\n  ...\n}\n```\n\n## Contributing\n\nAny and all contributions are welcome. Feel free to make a PR with any updates for fixes.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fuseverto%2Ftippar","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fuseverto%2Ftippar","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fuseverto%2Ftippar/lists"}