@gitmyabi-stg/brbtc 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md ADDED
@@ -0,0 +1,108 @@
1
+ # @gitmyabi-stg/brbtc
2
+
3
+ Auto-generated TypeScript type bindings for **brBTC**
4
+
5
+ - **Build ID**: `etherscan-brbtc-2ec37d45-1780063178083`
6
+ - **Build Number**: 1
7
+ - **Commit**: `72a75b3`
8
+ - **Branch**: `etherscan`
9
+ - **Target**: `ethers-v6`
10
+ - **Contracts**: 2
11
+
12
+ ## Installation
13
+
14
+ ```bash
15
+ npm install @gitmyabi-stg/brbtc@0.0.1
16
+ ```
17
+
18
+ ## Usage
19
+
20
+ ### Class-based API (TypeChain-like)
21
+
22
+ ```typescript
23
+ import { createPublicClient, createWalletClient, http } from 'viem';
24
+ import { mainnet } from 'viem/chains';
25
+ import { YourContract } from '@gitmyabi-stg/brbtc';
26
+
27
+ const publicClient = createPublicClient({ chain: mainnet, transport: http() });
28
+ const walletClient = createWalletClient({ chain: mainnet, transport: http() });
29
+
30
+ // Create contract instance
31
+ const contract = new YourContract('0x...', { publicClient, walletClient });
32
+
33
+ // Read functions - call directly like TypeChain!
34
+ const result = await contract.yourMethod(param1, param2);
35
+
36
+ // Write functions - also call directly!
37
+ const hash = await contract.transfer('0x...', 1000n);
38
+ ```
39
+
40
+ ### With viem directly
41
+
42
+ ```typescript
43
+ import { createPublicClient, http } from 'viem';
44
+ import { mainnet } from 'viem/chains';
45
+ import { YourContractAbi } from '@gitmyabi-stg/brbtc';
46
+
47
+ const client = createPublicClient({
48
+ chain: mainnet,
49
+ transport: http(),
50
+ });
51
+
52
+ // Fully typed contract read
53
+ const result = await client.readContract({
54
+ address: '0x...',
55
+ abi: YourContractAbi,
56
+ functionName: 'yourMethod',
57
+ args: [param1, param2],
58
+ });
59
+
60
+ // Fully typed contract write
61
+ const hash = await client.writeContract({
62
+ address: '0x...',
63
+ abi: YourContractAbi,
64
+ functionName: 'yourMethod',
65
+ args: [param1, param2],
66
+ });
67
+ ```
68
+
69
+ ### With wagmi
70
+
71
+ ```typescript
72
+ import { useReadContract, useWriteContract } from 'wagmi';
73
+ import { YourContractAbi } from '@gitmyabi-stg/brbtc';
74
+
75
+ function MyComponent() {
76
+ const { data } = useReadContract({
77
+ address: '0x...',
78
+ abi: YourContractAbi,
79
+ functionName: 'yourMethod',
80
+ args: [param1, param2],
81
+ });
82
+
83
+ const { writeContract } = useWriteContract();
84
+
85
+ const handleWrite = () => {
86
+ writeContract({
87
+ address: '0x...',
88
+ abi: YourContractAbi,
89
+ functionName: 'yourMethod',
90
+ args: [param1, param2],
91
+ });
92
+ };
93
+
94
+ return <button onClick={handleWrite}>Call Contract</button>;
95
+ }
96
+ ```
97
+
98
+ ## Type Safety
99
+
100
+ This package provides full TypeScript type safety for all contract methods, events, and parameters using viem's type system. All ABIs are exported as `const` assertions for maximum type inference.
101
+
102
+ ## Generated Contracts
103
+
104
+ This package includes type bindings for 2 contract(s) generated from ABI artifacts.
105
+
106
+ ## License
107
+
108
+ Apache License 2.0
@@ -0,0 +1,173 @@
1
+ import type { Address, PublicClient, WalletClient } from 'viem';
2
+ /**
3
+ * TransparentUpgradeableProxy ABI
4
+ *
5
+ * This ABI is typed using viem's type system for full type safety.
6
+ */
7
+ export declare const TransparentUpgradeableProxyAbi: readonly [{
8
+ readonly inputs: readonly [{
9
+ readonly internalType: "address";
10
+ readonly name: "_logic";
11
+ readonly type: "address";
12
+ }, {
13
+ readonly internalType: "address";
14
+ readonly name: "admin_";
15
+ readonly type: "address";
16
+ }, {
17
+ readonly internalType: "bytes";
18
+ readonly name: "_data";
19
+ readonly type: "bytes";
20
+ }];
21
+ readonly stateMutability: "payable";
22
+ readonly type: "constructor";
23
+ }, {
24
+ readonly anonymous: false;
25
+ readonly inputs: readonly [{
26
+ readonly indexed: false;
27
+ readonly internalType: "address";
28
+ readonly name: "previousAdmin";
29
+ readonly type: "address";
30
+ }, {
31
+ readonly indexed: false;
32
+ readonly internalType: "address";
33
+ readonly name: "newAdmin";
34
+ readonly type: "address";
35
+ }];
36
+ readonly name: "AdminChanged";
37
+ readonly type: "event";
38
+ }, {
39
+ readonly anonymous: false;
40
+ readonly inputs: readonly [{
41
+ readonly indexed: true;
42
+ readonly internalType: "address";
43
+ readonly name: "beacon";
44
+ readonly type: "address";
45
+ }];
46
+ readonly name: "BeaconUpgraded";
47
+ readonly type: "event";
48
+ }, {
49
+ readonly anonymous: false;
50
+ readonly inputs: readonly [{
51
+ readonly indexed: true;
52
+ readonly internalType: "address";
53
+ readonly name: "implementation";
54
+ readonly type: "address";
55
+ }];
56
+ readonly name: "Upgraded";
57
+ readonly type: "event";
58
+ }, {
59
+ readonly stateMutability: "payable";
60
+ readonly type: "fallback";
61
+ }, {
62
+ readonly stateMutability: "payable";
63
+ readonly type: "receive";
64
+ }];
65
+ /**
66
+ * Type-safe ABI for TransparentUpgradeableProxy
67
+ */
68
+ export type TransparentUpgradeableProxyAbi = typeof TransparentUpgradeableProxyAbi;
69
+ /**
70
+ * Contract instance type for TransparentUpgradeableProxy
71
+ */
72
+ export type TransparentUpgradeableProxyContract = any;
73
+ /**
74
+ * TransparentUpgradeableProxy Contract Class
75
+ *
76
+ * Provides a class-based API similar to TypeChain for interacting with the contract.
77
+ *
78
+ * @example
79
+ * ```typescript
80
+ * import { createPublicClient, createWalletClient, http } from 'viem';
81
+ * import { mainnet } from 'viem/chains';
82
+ * import { TransparentUpgradeableProxy } from 'TransparentUpgradeableProxy';
83
+ *
84
+ * const publicClient = createPublicClient({ chain: mainnet, transport: http() });
85
+ * const walletClient = createWalletClient({ chain: mainnet, transport: http() });
86
+ *
87
+ * const contract = new TransparentUpgradeableProxy('0x...', { publicClient, walletClient });
88
+ *
89
+ * // Read functions
90
+ * const result = await contract.balanceOf('0x...');
91
+ *
92
+ * // Write functions
93
+ * const hash = await contract.transfer('0x...', 1000n);
94
+ *
95
+ * // Simulate transactions (dry-run)
96
+ * const simulation = await contract.simulate.transfer('0x...', 1000n);
97
+ * console.log('Gas estimate:', simulation.request.gas);
98
+ *
99
+ * // Watch events
100
+ * const unwatch = contract.watch.Transfer((event) => {
101
+ * console.log('Transfer event:', event);
102
+ * });
103
+ * ```
104
+ */
105
+ export declare class TransparentUpgradeableProxy {
106
+ private contract;
107
+ private contractAddress;
108
+ private publicClient;
109
+ constructor(address: Address, clients: {
110
+ publicClient: PublicClient;
111
+ walletClient?: WalletClient;
112
+ });
113
+ /**
114
+ * Get the contract address
115
+ */
116
+ get address(): Address;
117
+ /**
118
+ * Get the underlying viem contract instance.
119
+ */
120
+ getContract(): TransparentUpgradeableProxyContract;
121
+ /**
122
+ * Simulate contract write operations (dry-run without sending transaction)
123
+ *
124
+ * Note: This contract has no write functions, so simulate returns an empty object.
125
+ */
126
+ get simulate(): {};
127
+ /**
128
+ * Watch contract events
129
+ *
130
+ * @example
131
+ * // Watch all Transfer events
132
+ * const unwatch = contract.watch.Transfer((event) => {
133
+ * console.log('Transfer:', event);
134
+ * });
135
+ *
136
+ * // Stop watching
137
+ * unwatch();
138
+ */
139
+ get watch(): {
140
+ /**
141
+ * Watch AdminChanged events
142
+ * @param callback Function to call when event is emitted
143
+ * @param filter Optional filter for indexed parameters
144
+ * @returns Unwatch function to stop listening
145
+ */
146
+ AdminChanged: (callback: (event: {
147
+ previousAdmin: `0x${string}`;
148
+ newAdmin: `0x${string}`;
149
+ }) => void) => () => void;
150
+ /**
151
+ * Watch BeaconUpgraded events
152
+ * @param callback Function to call when event is emitted
153
+ * @param filter Optional filter for indexed parameters
154
+ * @returns Unwatch function to stop listening
155
+ */
156
+ BeaconUpgraded: (callback: (event: {
157
+ beacon: `0x${string}`;
158
+ }) => void, filter?: {
159
+ beacon?: `0x${string}` | `0x${string}`[] | null;
160
+ }) => () => void;
161
+ /**
162
+ * Watch Upgraded events
163
+ * @param callback Function to call when event is emitted
164
+ * @param filter Optional filter for indexed parameters
165
+ * @returns Unwatch function to stop listening
166
+ */
167
+ Upgraded: (callback: (event: {
168
+ implementation: `0x${string}`;
169
+ }) => void, filter?: {
170
+ implementation?: `0x${string}` | `0x${string}`[] | null;
171
+ }) => () => void;
172
+ };
173
+ }
@@ -0,0 +1,226 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.TransparentUpgradeableProxy = exports.TransparentUpgradeableProxyAbi = void 0;
4
+ const viem_1 = require("viem");
5
+ /**
6
+ * TransparentUpgradeableProxy ABI
7
+ *
8
+ * This ABI is typed using viem's type system for full type safety.
9
+ */
10
+ exports.TransparentUpgradeableProxyAbi = [
11
+ {
12
+ "inputs": [
13
+ {
14
+ "internalType": "address",
15
+ "name": "_logic",
16
+ "type": "address"
17
+ },
18
+ {
19
+ "internalType": "address",
20
+ "name": "admin_",
21
+ "type": "address"
22
+ },
23
+ {
24
+ "internalType": "bytes",
25
+ "name": "_data",
26
+ "type": "bytes"
27
+ }
28
+ ],
29
+ "stateMutability": "payable",
30
+ "type": "constructor"
31
+ },
32
+ {
33
+ "anonymous": false,
34
+ "inputs": [
35
+ {
36
+ "indexed": false,
37
+ "internalType": "address",
38
+ "name": "previousAdmin",
39
+ "type": "address"
40
+ },
41
+ {
42
+ "indexed": false,
43
+ "internalType": "address",
44
+ "name": "newAdmin",
45
+ "type": "address"
46
+ }
47
+ ],
48
+ "name": "AdminChanged",
49
+ "type": "event"
50
+ },
51
+ {
52
+ "anonymous": false,
53
+ "inputs": [
54
+ {
55
+ "indexed": true,
56
+ "internalType": "address",
57
+ "name": "beacon",
58
+ "type": "address"
59
+ }
60
+ ],
61
+ "name": "BeaconUpgraded",
62
+ "type": "event"
63
+ },
64
+ {
65
+ "anonymous": false,
66
+ "inputs": [
67
+ {
68
+ "indexed": true,
69
+ "internalType": "address",
70
+ "name": "implementation",
71
+ "type": "address"
72
+ }
73
+ ],
74
+ "name": "Upgraded",
75
+ "type": "event"
76
+ },
77
+ {
78
+ "stateMutability": "payable",
79
+ "type": "fallback"
80
+ },
81
+ {
82
+ "stateMutability": "payable",
83
+ "type": "receive"
84
+ }
85
+ ];
86
+ /**
87
+ * TransparentUpgradeableProxy Contract Class
88
+ *
89
+ * Provides a class-based API similar to TypeChain for interacting with the contract.
90
+ *
91
+ * @example
92
+ * ```typescript
93
+ * import { createPublicClient, createWalletClient, http } from 'viem';
94
+ * import { mainnet } from 'viem/chains';
95
+ * import { TransparentUpgradeableProxy } from 'TransparentUpgradeableProxy';
96
+ *
97
+ * const publicClient = createPublicClient({ chain: mainnet, transport: http() });
98
+ * const walletClient = createWalletClient({ chain: mainnet, transport: http() });
99
+ *
100
+ * const contract = new TransparentUpgradeableProxy('0x...', { publicClient, walletClient });
101
+ *
102
+ * // Read functions
103
+ * const result = await contract.balanceOf('0x...');
104
+ *
105
+ * // Write functions
106
+ * const hash = await contract.transfer('0x...', 1000n);
107
+ *
108
+ * // Simulate transactions (dry-run)
109
+ * const simulation = await contract.simulate.transfer('0x...', 1000n);
110
+ * console.log('Gas estimate:', simulation.request.gas);
111
+ *
112
+ * // Watch events
113
+ * const unwatch = contract.watch.Transfer((event) => {
114
+ * console.log('Transfer event:', event);
115
+ * });
116
+ * ```
117
+ */
118
+ class TransparentUpgradeableProxy {
119
+ constructor(address, clients) {
120
+ this.contractAddress = address;
121
+ this.publicClient = clients.publicClient;
122
+ this.contract = (0, viem_1.getContract)({
123
+ address,
124
+ abi: exports.TransparentUpgradeableProxyAbi,
125
+ client: {
126
+ public: clients.publicClient,
127
+ wallet: clients.walletClient,
128
+ },
129
+ });
130
+ }
131
+ /**
132
+ * Get the contract address
133
+ */
134
+ get address() {
135
+ return this.contractAddress;
136
+ }
137
+ /**
138
+ * Get the underlying viem contract instance.
139
+ */
140
+ getContract() {
141
+ return this.contract;
142
+ }
143
+ // No read functions
144
+ // No write functions
145
+ /**
146
+ * Simulate contract write operations (dry-run without sending transaction)
147
+ *
148
+ * Note: This contract has no write functions, so simulate returns an empty object.
149
+ */
150
+ get simulate() {
151
+ return {};
152
+ }
153
+ /**
154
+ * Watch contract events
155
+ *
156
+ * @example
157
+ * // Watch all Transfer events
158
+ * const unwatch = contract.watch.Transfer((event) => {
159
+ * console.log('Transfer:', event);
160
+ * });
161
+ *
162
+ * // Stop watching
163
+ * unwatch();
164
+ */
165
+ get watch() {
166
+ return {
167
+ /**
168
+ * Watch AdminChanged events
169
+ * @param callback Function to call when event is emitted
170
+ * @param filter Optional filter for indexed parameters
171
+ * @returns Unwatch function to stop listening
172
+ */
173
+ AdminChanged: (callback) => {
174
+ return this.publicClient.watchContractEvent({
175
+ address: this.contractAddress,
176
+ abi: exports.TransparentUpgradeableProxyAbi,
177
+ eventName: 'AdminChanged',
178
+ onLogs: (logs) => {
179
+ logs.forEach((log) => {
180
+ callback(log.args);
181
+ });
182
+ },
183
+ });
184
+ },
185
+ /**
186
+ * Watch BeaconUpgraded events
187
+ * @param callback Function to call when event is emitted
188
+ * @param filter Optional filter for indexed parameters
189
+ * @returns Unwatch function to stop listening
190
+ */
191
+ BeaconUpgraded: (callback, filter) => {
192
+ return this.publicClient.watchContractEvent({
193
+ address: this.contractAddress,
194
+ abi: exports.TransparentUpgradeableProxyAbi,
195
+ eventName: 'BeaconUpgraded',
196
+ args: filter,
197
+ onLogs: (logs) => {
198
+ logs.forEach((log) => {
199
+ callback(log.args);
200
+ });
201
+ },
202
+ });
203
+ },
204
+ /**
205
+ * Watch Upgraded events
206
+ * @param callback Function to call when event is emitted
207
+ * @param filter Optional filter for indexed parameters
208
+ * @returns Unwatch function to stop listening
209
+ */
210
+ Upgraded: (callback, filter) => {
211
+ return this.publicClient.watchContractEvent({
212
+ address: this.contractAddress,
213
+ abi: exports.TransparentUpgradeableProxyAbi,
214
+ eventName: 'Upgraded',
215
+ args: filter,
216
+ onLogs: (logs) => {
217
+ logs.forEach((log) => {
218
+ callback(log.args);
219
+ });
220
+ },
221
+ });
222
+ }
223
+ };
224
+ }
225
+ }
226
+ exports.TransparentUpgradeableProxy = TransparentUpgradeableProxy;