Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move to Astar #1251

Merged
merged 54 commits into from
May 30, 2024
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
Show all changes
54 commits
Select commit Hold shift + click to select a range
56b3f06
Bump version to 0.3.41
prosoponator May 20, 2024
7092313
Add Astar as a network option
forgetso May 27, 2024
f68f3f1
Change default network to astar
forgetso May 27, 2024
a7c1a7a
Allow arrays of endpoints in network config
forgetso May 27, 2024
7e3ce0f
build:typechain
forgetso May 27, 2024
ef8530d
Use proper network type
forgetso May 27, 2024
f5b396d
Make network an array in test config
forgetso May 27, 2024
5087ee9
Make network array
forgetso May 27, 2024
c7ed571
Fix up existential deposit script to take network as argument
forgetso May 27, 2024
29cc4f3
Increase existential deposit for Astar
forgetso May 27, 2024
2f0a930
Set balances in contract that work for astar
forgetso May 27, 2024
099d985
Update contract
forgetso May 27, 2024
93e8d00
fmt
forgetso May 27, 2024
93a1cd6
Work with BN
forgetso May 27, 2024
2892c28
Use BN instead of number
forgetso May 27, 2024
722df2c
Use toString where toNumber could overflow
forgetso May 27, 2024
a230779
More rawNumbers
forgetso May 27, 2024
205560b
Update substrate contracts node to 18 decimal places
forgetso May 28, 2024
42e25f4
Convert a bunch of stakes to BN
forgetso May 28, 2024
b4b1605
Further restrict usage
forgetso May 28, 2024
fd2a3f1
lint:fix
forgetso May 28, 2024
d3e53ff
lint docker compose files
forgetso May 28, 2024
bc8f933
prettier ignore unknown files
goastler May 28, 2024
87d4e23
remove debug
goastler May 28, 2024
eacad23
add docker files to linting cmd
goastler May 28, 2024
3de5156
lint docker files
goastler May 28, 2024
e4f75a9
TransferContracts script
HughParry May 28, 2024
0fabd10
merge
HughParry May 28, 2024
c5afef7
Merge branch 'astar' of github.com:prosopo/captcha into astar
forgetso May 28, 2024
828864b
Fix tests
forgetso May 28, 2024
566d1ea
Remove .only in tests
forgetso May 28, 2024
2955536
Change docker image
forgetso May 28, 2024
c9cad80
Add admin account bytes for astar
forgetso May 28, 2024
85769e1
Merge branch 'main' into production
forgetso May 28, 2024
4e3a740
build:typechain
forgetso May 28, 2024
1733d0b
Tidy up deploy process
forgetso May 28, 2024
ecad1ee
Merge remote-tracking branch 'origin/adding-transfer-provider-script'…
forgetso May 28, 2024
bc688c7
Add CLI methods for contract scripts. Put submitTx in tx package
forgetso May 28, 2024
c17c307
Fix for StorageDepositLimitExhausted. Use instead of 0
forgetso May 28, 2024
3317d1e
lint and use in lots of places
forgetso May 28, 2024
460c42e
only register dapps that don't exist
forgetso May 28, 2024
8f96554
Use log
forgetso May 28, 2024
5737387
Finish transfer contract script
forgetso May 29, 2024
b50674b
Set contract admin to Alice
forgetso May 29, 2024
ced85ff
linting and package-lock
forgetso May 29, 2024
cd78144
build:typechain
forgetso May 29, 2024
ed48731
Fix dev deployment
forgetso May 29, 2024
b19fc27
remove debug
forgetso May 29, 2024
73c3be6
lint:fix
forgetso May 29, 2024
5e8037b
README tidy
forgetso May 29, 2024
f6e48f9
Add transfer-to option
forgetso May 29, 2024
1aff9f8
Update README
forgetso May 29, 2024
7b0064a
Add CLI info to README
forgetso May 29, 2024
98f4634
Remove redundant
forgetso May 29, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion dev/config/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
"@babel/plugin-transform-react-jsx": "^7.24.6",
"@babel/plugin-transform-runtime": "^7.24.3",
"@babel/preset-env": "^7.24.5",
"@polkadot/dev": "^0.76.11",
HughParry marked this conversation as resolved.
Show resolved Hide resolved
"@prosopo/common": "0.3.41",
"@prosopo/types": "0.3.41",
"@prosopo/util": "0.3.41",
Expand Down Expand Up @@ -108,4 +109,4 @@
"registry": "https://registry.npmjs.org"
},
"sideEffects": false
}
}
88 changes: 88 additions & 0 deletions dev/scripts/src/contract/transferContract.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
import { DappPayee } from '@prosopo/captcha-contract'
import { ProviderEnvironment } from '@prosopo/env'
import { Tasks } from '@prosopo/provider'
import { defaultConfig, loadEnv } from '@prosopo/cli'
import { exit } from 'process'
import { getPairAsync } from '@prosopo/contract'
import mongoose from 'mongoose'
import path from 'path'

interface iDapp {
email: string
name: string
url: string
account: string
marketingPreferences: boolean
createdAt: number
}

const dappSchema: mongoose.Schema<iDapp> = new mongoose.Schema({
email: String,
name: String,
url: String,
account: String,
marketingPreferences: Boolean,
createdAt: Number,
})

const Dapp = mongoose.model('Dapp', dappSchema, 'emails')

const getAllMongoDapps = async (atlasUri: string) => {
await mongoose
.connect(atlasUri)
.then(() => console.log('Connected to MongoDB Atlas'))
.catch((err) => console.error('Error connecting to MongoDB:', err))

return await Dapp.find({})
}

// Doesn't work
// const getAllContractDapps = async () => {
// const config = defaultConfig()
// const network = config.networks[config.defaultNetwork]
// const secret = config.account.secret
// const pair = await getPairAsync(network, secret)
// const env = new ProviderEnvironment(config, pair)
// await env.isReady()
// const tasks = new Tasks(env)

// const dapps = await (tasks.contract.contract as any)['dappContracts']()

// return dapps
// }

// Function to register all dapps in contract
const registerDapps = async (addresses: string[]) => {
const config = defaultConfig()
const network = config.networks[config.defaultNetwork]
const secret = config.account.secret
const pair = await getPairAsync(network, secret)
const env = new ProviderEnvironment(config, pair)
await env.isReady()
const tasks = new Tasks(env)

addresses.forEach(async (address) => {
await tasks.contract.query.dappRegister(address, DappPayee.dapp)
forgetso marked this conversation as resolved.
Show resolved Hide resolved
})
}

// Function to get all provider details

// Function to register all providers in contract

const run = async () => {
const atlasUri = process.env._DEV_ONLY_ATLAS_URI

if (!atlasUri) {
throw new Error('Atlas URI not found in env')
}

const dapps = await getAllMongoDapps(atlasUri)
console.log(dapps)

await registerDapps(dapps.map((dapp: any) => dapp.account))

Check warning on line 83 in dev/scripts/src/contract/transferContract.ts

View workflow job for this annotation

GitHub Actions / check

Unexpected any. Specify a different type
exit(0)
}

loadEnv(path.resolve('.'))
run()
Loading
Loading