{"id":21934321,"url":"https://github.com/jayjay1024/eos-slots","last_synced_at":"2026-04-16T12:34:03.506Z","repository":{"id":124982084,"uuid":"152362995","full_name":"JayJay1024/EOS-Slots","owner":"JayJay1024","description":null,"archived":false,"fork":false,"pushed_at":"2018-10-11T09:38:52.000Z","size":164,"stargazers_count":1,"open_issues_count":0,"forks_count":2,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-01-27T13:11:32.124Z","etag":null,"topics":["eosjs","react","scatter"],"latest_commit_sha":null,"homepage":"http://hily.site/kijudgs/","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/JayJay1024.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2018-10-10T04:28:13.000Z","updated_at":"2018-12-10T02:48:15.000Z","dependencies_parsed_at":null,"dependency_job_id":"f81ca1a3-3ea2-4c48-9f46-8ea1d6f34ef5","html_url":"https://github.com/JayJay1024/EOS-Slots","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/JayJay1024%2FEOS-Slots","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JayJay1024%2FEOS-Slots/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JayJay1024%2FEOS-Slots/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JayJay1024%2FEOS-Slots/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/JayJay1024","download_url":"https://codeload.github.com/JayJay1024/EOS-Slots/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244965822,"owners_count":20539792,"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":["eosjs","react","scatter"],"created_at":"2024-11-29T00:15:30.802Z","updated_at":"2026-04-16T12:33:58.469Z","avatar_url":"https://github.com/JayJay1024.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"## Getting Started\n```\n1. 安装git和yarn(比如在ubuntu中安装git: sudo apt-get install git)\n2. 安装Chrome浏览器\n3. Chrome浏览器安装Scatter插件\n4. git clone git@github.com:LucienLau/EOS-Slots.git\n5. cd EOS-Slots\n6. yarn install\n7. yarn start\n```\n\n## 说明\n###### 安装eosjs库\n`yarn add eosjs`\n###### 引入eosjs库\n`import EOS from 'eosjs'`\n###### 初始化eosjs句柄\n```\nconst network = {\n    blockchain: 'eos',\n    protocol: 'http',\n    host: 'api.kylin.eosbeijing.one',\n    port: 8880,\n    chainId: '5fff1dae8dc8e2fc4d5b23b2c7665c97f9e9d8edf2b6485a86ba311c25639191'  // kylin net\n}\n\nthis.eosjs = Eos({\n    httpEndpoint: `${network.protocol}://${network.host}:${network.port}`,\n    chainId: network.chainId\n});\n```\n###### 初始化scatter句柄\n```\ndocument.addEventListener('scatterLoaded', scatterExtension =\u003e {\n    this.scatter = window.scatter;\n    window.scatter = null;\n\n    if (this.scatter \u0026\u0026 this.scatter.identity) {\n        const account = this.scatter.identity.accounts.find(account =\u003e account.blockchain === 'eos');\n        this.setState({ player_account: account.name });\n        this.setState({ is_login: true });\n    }\n});\n```\n###### 调用scatter钱包获取账号授权\n```\nthis.scatter.getIdentity({ accounts: [network] }).then(() =\u003e {\n    const account = this.scatter.identity.accounts.find(account =\u003e account.blockchain === 'eos');\n    this.setState({ player_account: account.name });\n    this.setState({ is_login: true });\n});\n```\n###### 调用scatter钱包释放账号授权\n```\nthis.scatter.forgetIdentity().then(() =\u003e {\n    this.setState({ is_login: false });\n    this.setState({ player_account: 'Login' });\n});\n```\n###### 调用scatter钱包进行转账\n```\n// transfer '5 EOS' to 'bbbbbbbbbbbb' from 'aaaaaaaaaaaa' e.g.\nconst eos = this.scatter.eos(network, Eos, {});\neos.transfer({\n    from: 'aaaaaaaaaaaa',\n    to: 'bbbbbbbbbbbb',\n    quantity: '5.0000 EOS',\n    memo: 'test'\n}).then(res =\u003e {\n    console.log(success);\n    console.log(res);\n}).catch(e =\u003e {\n    console.error(e);\n});\n```\n###### 获取合约中Table的数据\n```\n// 比如账号aaaaaaaaaaaa部署了一份合约，合约中定义了一个叫record的表，表的code和scope都是self，则：\nthis.eosjs.getTableRows({\n    json: true,\n    code: 'aaaaaaaaaaaa',\n    scope: 'aaaaaaaaaaaa',\n    table: 'record',\n    // lower_bound: '2',  // 获取表中主键值大于等于2的行数据\n    // upper_bound: '2',  // 获取表中主键值小于2的行数据\n    // limit: 20          // 只获取20行数据\n}).then(res =\u003e {\n    console.log(success);\n    console.log(res);\n}).catch(e =\u003e {\n    console.error(e);\n});\n```\n###### 获取账户资产\n```\n// EOS代币在eosio.token合约的accounts表中\nthis.eosjs.getTableRows({\n    json: true,\n    code: 'eosio.token',\n    scope: this.state.player_account,\n    table: 'accounts'\n}).then(eosBalance =\u003e {\n    if ( eosBalance.rows[0] ) {\n        console.log('eos balance: ', eosBalance.rows[0].balance);\n    }\n}).catch(e =\u003e {\n    console.error(e);\n})\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjayjay1024%2Feos-slots","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjayjay1024%2Feos-slots","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjayjay1024%2Feos-slots/lists"}