-
Notifications
You must be signed in to change notification settings - Fork 91
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'origin' into eshaben/xcm-overhaul
- Loading branch information
Showing
102 changed files
with
2,197 additions
and
730 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
37 changes: 37 additions & 0 deletions
37
.snippets/code/builders/build/eth-api/dev-env/openzeppelin/PausableBox.sol
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
// SPDX-License-Identifier: MIT | ||
pragma solidity ^0.8.0; | ||
|
||
import "@openzeppelin/contracts-upgradeable/security/PausableUpgradeable.sol"; | ||
import "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol"; | ||
|
||
contract PausableBox is Initializable, PausableUpgradeable, OwnableUpgradeable { | ||
uint256 private value; | ||
|
||
// Emitted when the stored value changes | ||
event ValueChanged(uint256 newValue); | ||
|
||
// Initialize | ||
function initialize() initializer public { | ||
__Ownable_init(_msgSender()); | ||
__Pausable_init_unchained(); | ||
} | ||
|
||
// Stores a new value in the contract | ||
function store(uint256 newValue) whenNotPaused public { | ||
value = newValue; | ||
emit ValueChanged(newValue); | ||
} | ||
|
||
// Reads the last stored value | ||
function retrieve() public view returns (uint256) { | ||
return value; | ||
} | ||
|
||
function pause() public onlyOwner { | ||
_pause(); | ||
} | ||
|
||
function unpause() public onlyOwner { | ||
_unpause(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletions
4
.snippets/code/builders/build/eth-api/libraries/web3-js/get.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 0 additions & 1 deletion
1
.snippets/code/builders/build/eth-api/libraries/web3-py/balances.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,3 @@ | ||
# 1. Add import | ||
from web3 import Web3 | ||
|
||
# 1. Add the Web3 provider logic here: | ||
|
14 changes: 14 additions & 0 deletions
14
.snippets/code/builders/get-started/eth-compare/balances/balance.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import { ApiPromise, WsProvider } from '@polkadot/api'; | ||
|
||
const wsProvider = new WsProvider('wss://wss.api.moonbase.moonbeam.network'); | ||
|
||
const main = async () => { | ||
const polkadotApi = await ApiPromise.create({ | ||
provider: wsProvider, | ||
}); | ||
|
||
const balances = await polkadotApi.query.balances.account('INSERT_ADDRESS'); | ||
console.log(balances.toHuman()); | ||
}; | ||
|
||
main(); |
14 changes: 14 additions & 0 deletions
14
.snippets/code/builders/get-started/eth-compare/balances/locks.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import { ApiPromise, WsProvider } from '@polkadot/api'; | ||
|
||
const wsProvider = new WsProvider('wss://wss.api.moonbase.moonbeam.network'); | ||
|
||
const main = async () => { | ||
const polkadotApi = await ApiPromise.create({ | ||
provider: wsProvider, | ||
}); | ||
|
||
const locks = await polkadotApi.query.balances.locks('INSERT_ADDRESS'); | ||
console.log(locks.toHuman()); | ||
}; | ||
|
||
main(); |
40 changes: 40 additions & 0 deletions
40
.snippets/code/builders/integrations/wallets/particle/configure-aa.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
import { ParticleNetwork } from '@particle-network/auth'; | ||
import { Moonbeam } from '@particle-network/chains'; | ||
import { ParticleProvider } from '@particle-network/provider'; | ||
import { SmartAccount } from '@particle-network/aa'; | ||
|
||
// Project ID, Client Key, and App ID from https://dashboard.particle.network | ||
const config = { | ||
projectId: process.env.REACT_APP_PROJECT_ID, | ||
clientKey: process.env.REACT_APP_CLIENT_KEY, | ||
appId: process.env.REACT_APP_APP_ID, | ||
}; | ||
|
||
const particle = new ParticleNetwork({ | ||
...config, | ||
chainName: Moonbeam.name, | ||
chainId: Moonbeam.id, | ||
wallet: { displayWalletEntry: true }, | ||
}); | ||
|
||
// If using ERC-4337 AA | ||
const provider = new ParticleProvider(particle.auth); | ||
const smartAccount = new SmartAccount(provider, { | ||
...config, | ||
aaOptions: { | ||
accountContracts: { | ||
SIMPLE: [ | ||
{ | ||
version: '1.0.0', | ||
chainIds: [Moonbeam.id], | ||
}, | ||
], | ||
}, | ||
}, | ||
}); | ||
|
||
// Sets wallet UI to use AA mode | ||
particle.setERC4337({ | ||
name: 'SIMPLE', | ||
version: '1.0.0', | ||
}); |
16 changes: 16 additions & 0 deletions
16
.snippets/code/builders/integrations/wallets/particle/configure-particle.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import { ParticleNetwork } from '@particle-network/auth'; | ||
import { Moonbeam } from '@particle-network/chains'; | ||
|
||
// Project ID, Client Key, and App ID from https://dashboard.particle.network | ||
const config = { | ||
projectId: process.env.REACT_APP_PROJECT_ID, | ||
clientKey: process.env.REACT_APP_CLIENT_KEY, | ||
appId: process.env.REACT_APP_APP_ID, | ||
}; | ||
|
||
const particle = new ParticleNetwork({ | ||
...config, | ||
chainName: Moonbeam.name, | ||
chainId: Moonbeam.id, | ||
wallet: { displayWalletEntry: true }, | ||
}); |
45 changes: 45 additions & 0 deletions
45
.snippets/code/builders/integrations/wallets/particle/custom-ethers-provider.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
import { ParticleNetwork } from '@particle-network/auth'; | ||
import { Moonbeam } from '@particle-network/chains'; | ||
import { ParticleProvider } from '@particle-network/provider'; | ||
import { SmartAccount, AAWrapProvider } from '@particle-network/aa'; | ||
import { ethers } from 'ethers'; | ||
|
||
// Project ID, Client Key, and App ID from https://dashboard.particle.network | ||
const config = { | ||
projectId: process.env.REACT_APP_PROJECT_ID, | ||
clientKey: process.env.REACT_APP_CLIENT_KEY, | ||
appId: process.env.REACT_APP_APP_ID, | ||
}; | ||
|
||
const particle = new ParticleNetwork({ | ||
...config, | ||
chainName: Moonbeam.name, | ||
chainId: Moonbeam.id, | ||
wallet: { displayWalletEntry: true }, | ||
}); | ||
|
||
// If using ERC-4337 AA | ||
const provider = new ParticleProvider(particle.auth); | ||
const smartAccount = new SmartAccount(provider, { | ||
...config, | ||
aaOptions: { | ||
accountContracts: { | ||
SIMPLE: [ | ||
{ | ||
version: '1.0.0', | ||
chainIds: [Moonbeam.id], | ||
}, | ||
], | ||
}, | ||
}, | ||
}); | ||
|
||
// Sets wallet UI to use AA mode | ||
particle.setERC4337({ | ||
name: 'SIMPLE', | ||
version: '1.0.0', | ||
}); | ||
|
||
// Uses custom EIP-1193 AA provider | ||
const wrapProvider = new AAWrapProvider(smartAccount); | ||
const customProvider = new ethers.BrowserProvider(wrapProvider); |
45 changes: 45 additions & 0 deletions
45
.snippets/code/builders/integrations/wallets/particle/custom-web3-provider.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
import { ParticleNetwork } from '@particle-network/auth'; | ||
import { Moonbeam } from '@particle-network/chains'; | ||
import { ParticleProvider } from '@particle-network/provider'; | ||
import { SmartAccount, AAWrapProvider } from '@particle-network/aa'; | ||
import { Web3 } from 'web3'; | ||
|
||
// Project ID, Client Key, and App ID from https://dashboard.particle.network | ||
const config = { | ||
projectId: process.env.REACT_APP_PROJECT_ID, | ||
clientKey: process.env.REACT_APP_CLIENT_KEY, | ||
appId: process.env.REACT_APP_APP_ID, | ||
}; | ||
|
||
const particle = new ParticleNetwork({ | ||
...config, | ||
chainName: Moonbeam.name, | ||
chainId: Moonbeam.id, | ||
wallet: { displayWalletEntry: true }, | ||
}); | ||
|
||
// If using ERC-4337 AA | ||
const provider = new ParticleProvider(particle.auth); | ||
const smartAccount = new SmartAccount(provider, { | ||
...config, | ||
aaOptions: { | ||
accountContracts: { | ||
SIMPLE: [ | ||
{ | ||
version: '1.0.0', | ||
chainIds: [Moonbeam.id], | ||
}, | ||
], | ||
}, | ||
}, | ||
}); | ||
|
||
// Sets wallet UI to use AA mode | ||
particle.setERC4337({ | ||
name: 'SIMPLE', | ||
version: '1.0.0', | ||
}); | ||
|
||
// Uses custom EIP-1193 AA provider | ||
const wrapProvider = new AAWrapProvider(smartAccount); | ||
const customProvider = new Web3(wrapProvider); |
Oops, something went wrong.