|
|
@ -4,7 +4,7 @@ import parse from 'parse-git-config'
|
|
|
|
import abi from './abi.js'
|
|
|
|
import abi from './abi.js'
|
|
|
|
|
|
|
|
|
|
|
|
// path -> /ab/123ab3123
|
|
|
|
// path -> /ab/123ab3123
|
|
|
|
export async function callContractMethod ({
|
|
|
|
export async function callContractMethod({
|
|
|
|
method = 'upload',
|
|
|
|
method = 'upload',
|
|
|
|
path,
|
|
|
|
path,
|
|
|
|
file,
|
|
|
|
file,
|
|
|
@ -23,7 +23,7 @@ export async function callContractMethod ({
|
|
|
|
: ethers.Wallet.fromMnemonic(key)
|
|
|
|
: ethers.Wallet.fromMnemonic(key)
|
|
|
|
|
|
|
|
|
|
|
|
etherWallet = etherWallet.connect(provider)
|
|
|
|
etherWallet = etherWallet.connect(provider)
|
|
|
|
const contract = new ethers.Contract('0x680336910D9357F6aDf26c0d61eAB8e65998Ab2d', abi, etherWallet);
|
|
|
|
const contract = new ethers.Contract('0xb940B75947F64C9fe0b4B2b6c56Fc9DEF03bBb5F', abi, etherWallet);
|
|
|
|
const pathBuffer = path ? Buffer.from(path) : ''
|
|
|
|
const pathBuffer = path ? Buffer.from(path) : ''
|
|
|
|
|
|
|
|
|
|
|
|
if (method === 'upload') {
|
|
|
|
if (method === 'upload') {
|
|
|
@ -52,23 +52,7 @@ export async function callContractMethod ({
|
|
|
|
sha: i[0].slice(2)
|
|
|
|
sha: i[0].slice(2)
|
|
|
|
}))
|
|
|
|
}))
|
|
|
|
|
|
|
|
|
|
|
|
refs = refs.concat([{ ref: 'HEAD', sha: 'refs/heads/main' }])
|
|
|
|
// refs = refs.concat([{ ref: 'HEAD', sha: 'refs/heads/main' }])
|
|
|
|
return refs
|
|
|
|
return refs
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// callContractMethod('kai', 'upload', '/07/549ed56229550960d2cb32b086df52304d9a86')
|
|
|
|
|
|
|
|
// callContractMethod('kai', 'download', '/07/549ed56229550960d2cb32b086df52304d9a86')
|
|
|
|
|
|
|
|
// callContractMethod({
|
|
|
|
|
|
|
|
// wallet: 'kai',
|
|
|
|
|
|
|
|
// method: 'setRef',
|
|
|
|
|
|
|
|
// path: '/refs/heads/master',
|
|
|
|
|
|
|
|
// sha: '07549ed56229550960d2cb32b086df52304d9a86'
|
|
|
|
|
|
|
|
// })
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
callContractMethod({
|
|
|
|
|
|
|
|
wallet: 'kai',
|
|
|
|
|
|
|
|
method: 'listRefs',
|
|
|
|
|
|
|
|
// path: '/refs/heads/master',
|
|
|
|
|
|
|
|
// sha: '07549ed56229550960d2cb32b086df52304d9a86'
|
|
|
|
|
|
|
|
})
|
|
|
|
|